I need help writing the methods for the song and playList class in Java. I already have the
interface and the getters and setter. Can someone help with the methods?
Song Class
public class Song
private String artist // the artist performing the song
private String title // the title of the song
private int minutes // number of min in length
private int seconds // number of seconds of length of the song (always less than 60)
// Add Getters / Setters for all fields
// Three constructors (remember to initialize ALL fields in each of the constructors - regardless
of the number of parameters!)
public Song(String artist, String title)
public Song(String artist, String title, int minutes, int seconds)
public Song(Song s)
public boolean equals(Object o) // a song is equal if all four fields are equal
public String toString() { // Use this code for toString EXACTLY
return \"{Song: title = \" + title + \" artist = \" + artist + \"}\";
}
public void play() { // Use this code for play EXACTLY
System.out.printf(\"Playing Song: artist = %-20s title = %s\ \", artist, title);
}
Make the Song class implement the interface Comparable, and make the ordering criteria as
follows: Songs will be ordered by artist in ascending order. If the artists are the same, then by
title in ascending order. If both artist and title are the same, then any order is acceptable.
Don’t forget to include any methods needed to implement the Playable interface.
PlayList Class
public class PlayList
Methods that modify the list should return a boolean return true if they successfully change the
list, otherwise they return false. Note that a PlayList can contain other PlayLists!
Methods that return a Playable element return null if they fail to find the song in question.
private String name // contains the name of the playlist
private ArrayList playableList // ArrayList of Playable elements that make up the play list
// Add Getters / Setters for name and songList
// Add a toString() method that returns the name of the playlist followed by its contents (by
calling toString() on each item it contains). You should only have one name/title per line
// Two constructors (remember to initialize ALL fields in each of the constructors - regardless of
the number of parameters!)
public PlayList() // empty play list named \"Untitled\"
public PlayList(String newName) // empty play list
public boolean loadSongs(String fileName) // loads songs from file, more on this below
public boolean clear() // removes all playable elements in the play list
public boolean addSong(Song s) // adds Song s to the end of the play list
public Playable removePlayable(int index) // removes Playable element at index from the list and
returns it
public Playable removePlayable(Playable p) // removes every occurrence of Playable p from the
list and returns p
public Playable getPlayable(int index) // returns the Playable element at the appropriate index
public boolean addPlayList(PlayList pl) //adds the PlayList that is being pa.
Need help with this java project, as the methods are proving to be p.pdfprajeetjain
Need help with this java project, as the methods are proving to be pretty challenging. Im not
worried about the fields, getters, setters, constructors, ect as those are pretty straightforward, but
any and all help with the methods would be greatly appreciated!
Playable Interface
public interface Playable
Create a Java interface named Playable that includes the following methods (and only the
following methods):
public void play();
public String getName(); // returns the name (for PlayList) or title (for Song) of Playable object.
public int getPlayTimeSeconds(); // For Song: returns the number of seconds in the song. For
PlayList: returns the number of seconds in the entire PlayList
Both the Song and PlayList classes will implement this interface.
Song Class
public class Song
private String artist // the artist performing the song
private String title // the title of the song
private int minutes // number of min in length
private int seconds // number of seconds of length of the song (always less than 60)
// Add Getters / Setters for all fields
// Three constructors (remember to initialize ALL fields in each of the constructors - regardless
of the number of parameters!)
public Song(String artist, String title)
public Song(String artist, String title, int minutes, int seconds)
public Song(Song s)
public boolean equals(Object o) // a song is equal if all four fields are equal
public String toString() { // Use this code for toString EXACTLY
return \"{Song: title = \" + title + \" artist = \" + artist + \"}\";
}
public void play() { // Use this code for play EXACTLY
System.out.printf(\"Playing Song: artist = %-20s title = %s\ \", artist, title);
}
Make the Song class implement the interface Comparable, and make the ordering criteria as
follows: Songs will be ordered by artist in ascending order. If the artists are the same, then by
title in ascending order. If both artist and title are the same, then any order is acceptable.
Don’t forget to include any methods needed to implement the Playable interface.
PlayList Class
public class PlayList
Methods that modify the list should return a boolean return true if they successfully change the
list, otherwise they return false. Note that a PlayList can contain other PlayLists!
Methods that return a Playable element return null if they fail to find the song in question.
private String name // contains the name of the playlist
private ArrayList playableList // ArrayList of Playable elements that make up the play list
// Add Getters / Setters for name and songList
// Add a toString() method that returns the name of the playlist followed by its contents (by
calling toString() on each item it contains). You should only have one name/title per line
// Two constructors (remember to initialize ALL fields in each of the constructors - regardless of
the number of parameters!)
public PlayList() // empty play list named \"Untitled\"
public PlayList(String newName) // empty play list
public boolean loadSongs(String fil.
Can someone please help me implement the addSong function .pdfakshpatil4
Can someone please help me implement the "addSong" function in the code below? Thank
you!
// You are given a partially completed program that creates a list of songs, like a music repository.
// Each song has this information: song's id, song's name, singer's name, genre of the song, and
its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// You should not modify any of the given code, the return types, or the parameters, you will risk of
getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
char songName[MAX_SONG_NAME_LENGTH];
char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre;
unsigned int year;
};
struct musicRepository list[MAX_SONGS]; // declare the list of songs
int numSongs = 0; // the number of songs currently stored in the list (initialized to 0)
// Given functions
void initializeRepository(struct musicRepository repo[], int size);
void printRepository(struct musicRepository repo[], int numSongs);
void flushSngIn();
// functions that need to be implemented by you
int addSong(struct musicRepository repo[], char* songName, char* singerName, char* genre,
unsigned int year, int numSongs);
struct musicRepository* searchSong(struct musicRepository repo[], char* songName, int
numSongs);
void printSong(struct musicRepository repo[], int ID);
int editSong(struct musicRepository* repo, int numSongs, char* songName);
int deleteSongByName(struct musicRepository* repo, char* songName, int numSongs);
// This function takes in an array of musicRepository structures and the size of the array as
parameters. It then loops through each index of the array and sets the values of id, year, genre,
name, and singer to their respective initial values.
// NOTE that strcpy is used to copy an empty string to name and singer, rather than setting them
equal to "". This is because arrays in C are not assignable, so the strcpy function must be used to
copy the empty string into the array.
void initializeRepository(struct musicRepository repo[], int size)
{
for (int i = 0; i < size; i++)
{
repo[i].ID = 0;
repo[i].year = 0;
repo[i].genre = 0;
strcpy(repo[i].songName, "");
strcpy(repo[i].singerName, "");
}
}
// This function takes in the musicRepository array and iterates through each element. If the ID of
the song is not 0, it prints the details of the song.
void printRepository(struct musicRepository repo[], int numSongs)
{
printf("n--- Song Repository ---n");
for (int i = 0; i < numSongs; i++)
{
if (repo[i].ID != 0)
.
Write a program in C++ language that implements a music play.pdficonsystemsslm
Write a program in C++ language that implements a music player using Doubly Circular Linked
List using OOP concepts.
This assignment has four parts:
1- Write a class(new type) to define the Song type.
2- Implement the Doubly Circular Linked List, which will operate with Song type.
3- Implement the Music Player
4- Test it in the main function All Constructors should use the initializer list. 1. Song class
1- class song
#include <iostream>
using namespace std;
class Song{
private:
string songTitle;
string singerName;
public:
Song();
Song(string, string);
virtual ~Song();
string getSongTitle();
string getSingerName();
void setSongTitle(string);
void setSingerName(string);
friend ostream& operator<<(ostream& os, Song& p){
os << ": "<<"{"<<p.songTitle<<" : "<<p.singerName<<"}";
return os;
}
};
2- CNode class
#include <iostream>
#include "Song.h"
using namespace std;
class CNode{
private:
Song elem;
CNode *next;
CNode *prev;
friend class CircleDLinkedList;
};
3- CircleDLinkedList class
#include <iostream>
#include "CNode.h"
using namespace std;
class CircleDLinkedList{
private:
CNode* cursor;
int size;
public:
CircleDLinkedList();
~CircleDLinkedList();
bool empty();
void advance();
void add(Song &s);
void remove();
void print();
int getSize() const;
};
4- MusicPlayer class
#include <iostream>
#include "CircleDLinkedList.h"
using namespace std;
class MusicPlayer{
private:
string type; //will hold the type of the music player
int size; //the current number of the songs
CircleDLinkedList playerList; // list of the songs, CircleDLinkedList is the Doubly Circular Linked
List
public:
MusicPlayer(string);
virtual ~MusicPlayer();
void play(); //plays the current song, meaning that this method will print the properties of the Song
void next(); //moves to the net song and plays it
void previous(); ////moves to the previous song and plays it
void add (Song); //adds a song before the current song
void remove(); //removes the current song
void print(bool);//prints all songs that are in the list, starting from current to left is bool param is true
};
5- Test it in the main function
Create e musicplayer with 3 songs.
Play the current song.
Play the next song.
Play the next song.
Play the next song.
Play the previous song.
Print the list of the songs using bool parameter true.
Print the list of the songs using bool parameter false.
Remove the current song from the musicplayer.
Play the current song.
Play the next song.
Play the next song.
Play the next song.
Print the list of the songs using bool parameter true.
Print the list of the songs using bool parameter false..
Program 01 For this program you will complete the program in.pdfaddtechglobalmarketi
Program 01
For this program you will complete the program in the a05.c file. Find the places in the code
marked with the ToDo label and complete the work. You should not change any other part of the
code. This includes do not add any global variables or any other function. The program declares a
struct musicRepository with elements for songs ID, songs name, singers name, genre of the song,
and songs year. You will be completing a program that creates a list of songs (array of structs). It
is a menu-driven program where the user is given the following options:
Add a song to the repository - always inserted in the next available space in the array. The next
available array might not be next to the last song added, it might be somewhere in the middle.
Check Delete function below for details. If there is no space to add a new song, the function
should return -1, and 1 otherwise.
Search song by name - given the name of the song, return the struct with the data of the song.
Print a song - given a struct print its content. Please note that the Genre is an enum type;
however, the print function should print a string, not a number for this field.
Edit a song - given the name of the song, find it (using the Search function above), and modify
any of the fields of the song except ID. ID cannot be edited, and all fields should have a valid
value.
Delete a song - given the name of the song, find it (using the Search function above), and modify
the fields of the song (using the Edit function above), making ID, Year, and Genre 0, and name
and author an empty string. Return -1 if the song was not found, 1 if it was deleted.
Print the whole list of songs. Print the list of songs including all the fields of the song except for
ID.
// CSE240 SPRING 2023 Assignment 05
// Enter your name here
// You are given a partially completed program that creates a list of songs, like a
music repository.
// Each song has this information: song's id, song's name, singer's name, genre of
the song, and its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each resquired function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters, you will risk of getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
// WRITE COMMENTS FOR IMPORTANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
c.
Can someone please help me complete the add_song function .pdfakshpatil4
Can someone please help me complete the "add_song" function below. Thank you!
// Each song has this information: song's id, song's name, singer's name, genre of the song, and
its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// You should not modify any of the given code, the return types, or the parameters, you will risk of
getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
char songName[MAX_SONG_NAME_LENGTH];
char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre;
unsigned int year;
};
struct musicRepository list[MAX_SONGS]; // declare the list of songs
int numSongs = 0; // the number of songs currently stored in the list (initialized to 0)
// This function takes in an array of musicRepository structures and the size of the array as
parameters. It then loops through each index of the array and sets the values of id, year, genre,
name, and singer to their respective initial values.
// NOTE that strcpy is used to copy an empty string to name and singer, rather than setting them
equal to "". This is because arrays in C are not assignable, so the strcpy function must be used to
copy the empty string into the array.
void initializeRepository(struct musicRepository repo[], int size)
{
for (int i = 0; i < size; i++)
{
repo[i].ID = 0;
repo[i].year = 0;
repo[i].genre = 0;
strcpy(repo[i].songName, "");
strcpy(repo[i].singerName, "");
}
}
// This function takes in the musicRepository array and iterates through each element. If the ID of
the song is not 0, it prints the details of the song.
void printRepository(struct musicRepository repo[], int numSongs)
{
printf("n--- Song Repository ---n");
for (int i = 0; i < numSongs; i++)
{
if (repo[i].ID != 0)
{
printf("ID: %dn", repo[i].ID);
printf("Name: %sn", repo[i].songName);
printf("Singer: %sn", repo[i].singerName);
if (repo[i].genre == 0)
printf("Genre: unclassifiedn");
else if (repo[i].genre == 1)
printf("Genre: Popn");
else if (repo[i].genre == 2)
printf("Genre: Rockn");
else if (repo[i].genre == 3)
printf("Genre: Reggaen");
else if (repo[i].genre == 4)
printf("Genre: Countryn");
else if (repo[i].genre == 5)
printf("Genre: Bluesn");
else if (repo[i].genre == 6)
printf("Genre: Baladn");
printf("Year: %dn", repo[i].year);
printf("n");
}
}
}
// Problem 2
// struct to hold information about a song
struct Song
{
int id;
char name[MAX_SONG_NAME_LENGTH];
char singer[MAX_SINGER_NAME_LENGTH];
genreType genre;
int year;
struct Song* next;
};
// Function declarati.
PLEASE I need help with my assignment I have to compelet .pdfankit11134
PLEASE, I need help with my assignment. I have to compelet what come after (//TODO: ) LINE
AND IT SHOULD VAILD OUT PUT.
PLEASE, Keep in mind you can not change or add anything, just compelet the //TODO yellow , in
the code. please show me an output once you finish I wpuld be thankfull
****************************************************************************************************************
***************** THE CODE
****************************************************************************************************************
****************THE END OF THE CODE
I/ Enter your name here // You are given a partially completed program that creates a list of songs,
like a music repository. // Each song has this information: song's id, song's name, singer's name,
genre of the song, and its published year. // The struct "musicrepository" holds information of one
song. Genre is enum type. // An array of structs called 'tist' is made to hold the list of songs. // To
begin, you should trace through the given code and understand how it works. // Please read the
instructions above each resquired function and follow the directions carefully. // You should not
modify any of the given code, the return types, or the parameters, you will risk of getting
compilation error. 1/ You are not allowed to modify main (). I/ you can use string library functions. //
WRITE COMMENTS FOR IMPORTANT STEPS IN YOUR CODE. #include #include astdlib,h>
Hinclude #pragma warning(disable : 4996) // for visual studio only Wdefine MAX_SONGS 20
Wdefine MAX_SONG_NAME_LENGTH 40 #defIne MAX_SINGER_NAME_LENGTH 40 typedef
enum { unc lassified =0, Pop, Rock, Reggae, country, Blues, Balad, 3 genreType; // enum type
struct musicRepository { // struct for song details unsigned int IO; char
songName[MAX_SONG_NAME_LENGTH]; char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre; unsigned int year; 3 ; struct musicRepository list[MAX_SONGS]; // declare the
list of songs int numsongs = 0; / / the number of songs currently stored in the list (initialized to 0 ) //
Given functions void initializerepository(struct musicrepository repo[], int size); void
printrepository(struct musicrepository repo[], int numsongs); void flushsngin(); // functions that
need to be implemented by you int addsong(struct musickepository repo[], char *songName, char
*singername, char// This function is used to add a song into the list. You can simply add the new
song to the end of list (array of structs). // Do not allow the song to be added to the list if it already
exists in the list. You can do that by checking song names OR IDs already in the list. // If the song
already exists then return without adding it to the list. If the song does not exist in the list then add
the song at the end of the list and return 1. // If song list is full, then do not add new song to the list
and return 2. // The list should be case sensitive. For instance, "Case' and "case" should be
considered two different names. int addSong(str.
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdfarenamobiles123
8.15 Program: Playlist (C++) You will be building a linked list. Make sure to keep track of both
the head and tail nodes. (1) Create three files to submit. Playlist.h - Class declaration Playlist.cpp
- Class definition main.cpp - main() function Build the PlaylistNode class per the following
specifications. Note: Some functions can initially be function stubs (empty functions), to be
completed in later steps. Default constructor (1 pt) Parameterized constructor (1 pt) Public
member functions InsertAfter() (1 pt) SetNext() - Mutator (1 pt) GetID() - Accessor
GetSongName() - Accessor GetArtistName() - Accessor GetSongLength() - Accessor GetNext()
- Accessor PrintPlaylistNode() Private data members string uniqueID - Initialized to \"none\" in
default constructor string songName - Initialized to \"none\" in default constructor string
artistName - Initialized to \"none\" in default constructor int songLength - Initialized to 0 in
default constructor PlaylistNode* nextNodePtr - Initialized to 0 in default constructor Ex. of
PrintPlaylistNode output: Unique ID: S123 Song Name: Peg Artist Name: Steely Dan Song
Length (in seconds): 237 (2) In main(), prompt the user for the title of the playlist. (1 pt) Ex:
Enter playlist\'s title: JAMZ (3) Implement the PrintMenu() function. PrintMenu() takes the
playlist title as a parameter and outputs a menu of options to manipulate the playlist. Each option
is represented by a single character. Build and output the menu within the function. If an invalid
character is entered, continue to prompt for a valid choice. Hint: Implement Quit before
implementing other options. Call PrintMenu() in the main() function. Continue to execute the
menu until the user enters q to Quit. (3 pts) Ex: JAMZ PLAYLIST MENU a - Add song d -
Remove song c - Change position of song s - Output songs by specific artist t - Output total time
of playlist (in seconds) o - Output full playlist q - Quit Choose an option: (4) Implement \"Output
full playlist\" menu option. If the list is empty, output: Playlist is empty (3 pts) Ex: JAMZ -
OUTPUT FULL PLAYLIST 1. Unique ID: SD123 Song Name: Peg Artist Name: Steely Dan
Song Length (in seconds): 237 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet
Jackson Song Length (in seconds): 391 3. Unique ID: J345 Song Name: Canned Heat Artist
Name: Jamiroquai Song Length (in seconds): 330 4. Unique ID: JJ456 Song Name: Black Eagle
Artist Name: Janet Jackson Song Length (in seconds): 197 5. Unique ID: SD567 Song Name: I
Got The News Artist Name: Steely Dan Song Length (in seconds): 306 (5) Implement the \"Add
song\" menu item. New additions are added to the end of the list. (2 pts) Ex: ADD SONG Enter
song\'s unique ID: SD123 Enter song\'s name: Peg Enter artist\'s name: Steely Dan Enter song\'s
length (in seconds): 237 (6) Implement the \"Remove song\" function. Prompt the user for the
unique ID of the song to be removed.(4 pts) Ex: REMOVE SONG Enter song\'s unique ID:
JJ234 \"All For You\" remove.
Program 02 Based on the previous problem you should impleme.pdfaddtechglobalmarketi
Program 02
Based on the previous problem, you should implement this second problem in the same file a05.c.
Find the places in the code marked with the ToDo label and complete the work. You should not
change any other part of the code. This includes do not add any global variables or any other
function. For this problem, we are reusing the same struct from problem 1, but adding a pointer to
the struct to be able to create a linked list. In this problem, you must use linked list to create a user
playlist (play_list).
The struct is holding the information of a song: ID, Name, Singer, Genre, Year, and the pointer
Next (the pointer to the struct).
There should be the following functions. In the similar way we have done in previous assignments,
complete the following functions:
Add a song to the play_list - always inserted at the end of the list. Search song by name - given
the name of the song, return the struct with the data of the song.
Edit a song - given the name of the song, find it in the play_list and modify any of the fields of the
song (ID cannot be edited, and all fields should have a valid value). Return -1 if the song was not
found.
Delete a song - given the name of the song, find it, delete the song from the play_list (i.e.,
disconnect the node from the list). Return -1 if the song was not found, 1 if it was deleted.
// Problem 2
// struct to hold information about a song
struct Song
{
int id;
char name[MAX_SONG_NAME_LENGTH];
char singer[MAX_SINGER_NAME_LENGTH];
genreType genre;
int year;
struct Song *next;
};
// Function declarations
struct Song *createSong(int id, char *name, char *singer, char *genre, int year);
void printPlaylist(struct Song *playlist);
void add_song(struct Song **playlist, struct Song *newSong);
struct Song *search_song(struct Song *playlist, char *name);
int edit_song(struct Song *playlist, char *name, char *singer, char *genre, int
year);
int delete_song(struct Song *playlist, char *name);
// function to create a new song
struct Song *createSong(int id, char *name, char *singer, char *genre, int year)
{
struct Song *newSong = (struct Song *)malloc(sizeof(struct Song));
newSong->id = id;
strcpy(newSong->name, name);
strcpy(newSong->singer, singer);
if (strcmp(genre, "Pop") == 0)
newSong->genre = 1;
else if (strcmp(genre, "Rock") == 0)
newSong->genre = 2;
else if (strcmp(genre, "Reggae") == 0)
newSong->genre = 3;
else if (strcmp(genre, "Country") == 0)
newSong->genre = 4;
else if (strcmp(genre, "Blues") == 0)
newSong->genre = 5;
else if (strcmp(genre, "Balad") == 0)
newSong->genre = 6;
else
newSong->genre = 0;
newSong->year = year;
newSong->next = NULL;
return newSong;
}
// function to print the playlist
void printPlaylist(struct Song *playlist)
{
struct Song *current = playlist;
while (current != NULL)
{
printf("%dt%st%st%dt%dn", current->id, current->name, current->singer,
current->genre, current->year);
current = current->next;
}
}
// function to add a song to the end of the playlist
void add_song(struct Song .
Need help with this java project, as the methods are proving to be p.pdfprajeetjain
Need help with this java project, as the methods are proving to be pretty challenging. Im not
worried about the fields, getters, setters, constructors, ect as those are pretty straightforward, but
any and all help with the methods would be greatly appreciated!
Playable Interface
public interface Playable
Create a Java interface named Playable that includes the following methods (and only the
following methods):
public void play();
public String getName(); // returns the name (for PlayList) or title (for Song) of Playable object.
public int getPlayTimeSeconds(); // For Song: returns the number of seconds in the song. For
PlayList: returns the number of seconds in the entire PlayList
Both the Song and PlayList classes will implement this interface.
Song Class
public class Song
private String artist // the artist performing the song
private String title // the title of the song
private int minutes // number of min in length
private int seconds // number of seconds of length of the song (always less than 60)
// Add Getters / Setters for all fields
// Three constructors (remember to initialize ALL fields in each of the constructors - regardless
of the number of parameters!)
public Song(String artist, String title)
public Song(String artist, String title, int minutes, int seconds)
public Song(Song s)
public boolean equals(Object o) // a song is equal if all four fields are equal
public String toString() { // Use this code for toString EXACTLY
return \"{Song: title = \" + title + \" artist = \" + artist + \"}\";
}
public void play() { // Use this code for play EXACTLY
System.out.printf(\"Playing Song: artist = %-20s title = %s\ \", artist, title);
}
Make the Song class implement the interface Comparable, and make the ordering criteria as
follows: Songs will be ordered by artist in ascending order. If the artists are the same, then by
title in ascending order. If both artist and title are the same, then any order is acceptable.
Don’t forget to include any methods needed to implement the Playable interface.
PlayList Class
public class PlayList
Methods that modify the list should return a boolean return true if they successfully change the
list, otherwise they return false. Note that a PlayList can contain other PlayLists!
Methods that return a Playable element return null if they fail to find the song in question.
private String name // contains the name of the playlist
private ArrayList playableList // ArrayList of Playable elements that make up the play list
// Add Getters / Setters for name and songList
// Add a toString() method that returns the name of the playlist followed by its contents (by
calling toString() on each item it contains). You should only have one name/title per line
// Two constructors (remember to initialize ALL fields in each of the constructors - regardless of
the number of parameters!)
public PlayList() // empty play list named \"Untitled\"
public PlayList(String newName) // empty play list
public boolean loadSongs(String fil.
Can someone please help me implement the addSong function .pdfakshpatil4
Can someone please help me implement the "addSong" function in the code below? Thank
you!
// You are given a partially completed program that creates a list of songs, like a music repository.
// Each song has this information: song's id, song's name, singer's name, genre of the song, and
its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// You should not modify any of the given code, the return types, or the parameters, you will risk of
getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
char songName[MAX_SONG_NAME_LENGTH];
char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre;
unsigned int year;
};
struct musicRepository list[MAX_SONGS]; // declare the list of songs
int numSongs = 0; // the number of songs currently stored in the list (initialized to 0)
// Given functions
void initializeRepository(struct musicRepository repo[], int size);
void printRepository(struct musicRepository repo[], int numSongs);
void flushSngIn();
// functions that need to be implemented by you
int addSong(struct musicRepository repo[], char* songName, char* singerName, char* genre,
unsigned int year, int numSongs);
struct musicRepository* searchSong(struct musicRepository repo[], char* songName, int
numSongs);
void printSong(struct musicRepository repo[], int ID);
int editSong(struct musicRepository* repo, int numSongs, char* songName);
int deleteSongByName(struct musicRepository* repo, char* songName, int numSongs);
// This function takes in an array of musicRepository structures and the size of the array as
parameters. It then loops through each index of the array and sets the values of id, year, genre,
name, and singer to their respective initial values.
// NOTE that strcpy is used to copy an empty string to name and singer, rather than setting them
equal to "". This is because arrays in C are not assignable, so the strcpy function must be used to
copy the empty string into the array.
void initializeRepository(struct musicRepository repo[], int size)
{
for (int i = 0; i < size; i++)
{
repo[i].ID = 0;
repo[i].year = 0;
repo[i].genre = 0;
strcpy(repo[i].songName, "");
strcpy(repo[i].singerName, "");
}
}
// This function takes in the musicRepository array and iterates through each element. If the ID of
the song is not 0, it prints the details of the song.
void printRepository(struct musicRepository repo[], int numSongs)
{
printf("n--- Song Repository ---n");
for (int i = 0; i < numSongs; i++)
{
if (repo[i].ID != 0)
.
Write a program in C++ language that implements a music play.pdficonsystemsslm
Write a program in C++ language that implements a music player using Doubly Circular Linked
List using OOP concepts.
This assignment has four parts:
1- Write a class(new type) to define the Song type.
2- Implement the Doubly Circular Linked List, which will operate with Song type.
3- Implement the Music Player
4- Test it in the main function All Constructors should use the initializer list. 1. Song class
1- class song
#include <iostream>
using namespace std;
class Song{
private:
string songTitle;
string singerName;
public:
Song();
Song(string, string);
virtual ~Song();
string getSongTitle();
string getSingerName();
void setSongTitle(string);
void setSingerName(string);
friend ostream& operator<<(ostream& os, Song& p){
os << ": "<<"{"<<p.songTitle<<" : "<<p.singerName<<"}";
return os;
}
};
2- CNode class
#include <iostream>
#include "Song.h"
using namespace std;
class CNode{
private:
Song elem;
CNode *next;
CNode *prev;
friend class CircleDLinkedList;
};
3- CircleDLinkedList class
#include <iostream>
#include "CNode.h"
using namespace std;
class CircleDLinkedList{
private:
CNode* cursor;
int size;
public:
CircleDLinkedList();
~CircleDLinkedList();
bool empty();
void advance();
void add(Song &s);
void remove();
void print();
int getSize() const;
};
4- MusicPlayer class
#include <iostream>
#include "CircleDLinkedList.h"
using namespace std;
class MusicPlayer{
private:
string type; //will hold the type of the music player
int size; //the current number of the songs
CircleDLinkedList playerList; // list of the songs, CircleDLinkedList is the Doubly Circular Linked
List
public:
MusicPlayer(string);
virtual ~MusicPlayer();
void play(); //plays the current song, meaning that this method will print the properties of the Song
void next(); //moves to the net song and plays it
void previous(); ////moves to the previous song and plays it
void add (Song); //adds a song before the current song
void remove(); //removes the current song
void print(bool);//prints all songs that are in the list, starting from current to left is bool param is true
};
5- Test it in the main function
Create e musicplayer with 3 songs.
Play the current song.
Play the next song.
Play the next song.
Play the next song.
Play the previous song.
Print the list of the songs using bool parameter true.
Print the list of the songs using bool parameter false.
Remove the current song from the musicplayer.
Play the current song.
Play the next song.
Play the next song.
Play the next song.
Print the list of the songs using bool parameter true.
Print the list of the songs using bool parameter false..
Program 01 For this program you will complete the program in.pdfaddtechglobalmarketi
Program 01
For this program you will complete the program in the a05.c file. Find the places in the code
marked with the ToDo label and complete the work. You should not change any other part of the
code. This includes do not add any global variables or any other function. The program declares a
struct musicRepository with elements for songs ID, songs name, singers name, genre of the song,
and songs year. You will be completing a program that creates a list of songs (array of structs). It
is a menu-driven program where the user is given the following options:
Add a song to the repository - always inserted in the next available space in the array. The next
available array might not be next to the last song added, it might be somewhere in the middle.
Check Delete function below for details. If there is no space to add a new song, the function
should return -1, and 1 otherwise.
Search song by name - given the name of the song, return the struct with the data of the song.
Print a song - given a struct print its content. Please note that the Genre is an enum type;
however, the print function should print a string, not a number for this field.
Edit a song - given the name of the song, find it (using the Search function above), and modify
any of the fields of the song except ID. ID cannot be edited, and all fields should have a valid
value.
Delete a song - given the name of the song, find it (using the Search function above), and modify
the fields of the song (using the Edit function above), making ID, Year, and Genre 0, and name
and author an empty string. Return -1 if the song was not found, 1 if it was deleted.
Print the whole list of songs. Print the list of songs including all the fields of the song except for
ID.
// CSE240 SPRING 2023 Assignment 05
// Enter your name here
// You are given a partially completed program that creates a list of songs, like a
music repository.
// Each song has this information: song's id, song's name, singer's name, genre of
the song, and its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each resquired function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters, you will risk of getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
// WRITE COMMENTS FOR IMPORTANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
c.
Can someone please help me complete the add_song function .pdfakshpatil4
Can someone please help me complete the "add_song" function below. Thank you!
// Each song has this information: song's id, song's name, singer's name, genre of the song, and
its published year.
// The struct 'musicRepository' holds information of one song. Genre is enum type.
// An array of structs called 'list' is made to hold the list of songs.
// You should not modify any of the given code, the return types, or the parameters, you will risk of
getting compilation error.
// You are not allowed to modify main ().
// You can use string library functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable : 4996) // for Visual Studio Only
#define MAX_SONGS 20
#define MAX_SONG_NAME_LENGTH 40
#define MAX_SINGER_NAME_LENGTH 40
typedef enum
{
unclassified = 0,
Pop,
Rock,
Reggae,
Country,
Blues,
Balad,
} genreType; // enum type
struct musicRepository
{
// struct for song details
unsigned int ID;
char songName[MAX_SONG_NAME_LENGTH];
char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre;
unsigned int year;
};
struct musicRepository list[MAX_SONGS]; // declare the list of songs
int numSongs = 0; // the number of songs currently stored in the list (initialized to 0)
// This function takes in an array of musicRepository structures and the size of the array as
parameters. It then loops through each index of the array and sets the values of id, year, genre,
name, and singer to their respective initial values.
// NOTE that strcpy is used to copy an empty string to name and singer, rather than setting them
equal to "". This is because arrays in C are not assignable, so the strcpy function must be used to
copy the empty string into the array.
void initializeRepository(struct musicRepository repo[], int size)
{
for (int i = 0; i < size; i++)
{
repo[i].ID = 0;
repo[i].year = 0;
repo[i].genre = 0;
strcpy(repo[i].songName, "");
strcpy(repo[i].singerName, "");
}
}
// This function takes in the musicRepository array and iterates through each element. If the ID of
the song is not 0, it prints the details of the song.
void printRepository(struct musicRepository repo[], int numSongs)
{
printf("n--- Song Repository ---n");
for (int i = 0; i < numSongs; i++)
{
if (repo[i].ID != 0)
{
printf("ID: %dn", repo[i].ID);
printf("Name: %sn", repo[i].songName);
printf("Singer: %sn", repo[i].singerName);
if (repo[i].genre == 0)
printf("Genre: unclassifiedn");
else if (repo[i].genre == 1)
printf("Genre: Popn");
else if (repo[i].genre == 2)
printf("Genre: Rockn");
else if (repo[i].genre == 3)
printf("Genre: Reggaen");
else if (repo[i].genre == 4)
printf("Genre: Countryn");
else if (repo[i].genre == 5)
printf("Genre: Bluesn");
else if (repo[i].genre == 6)
printf("Genre: Baladn");
printf("Year: %dn", repo[i].year);
printf("n");
}
}
}
// Problem 2
// struct to hold information about a song
struct Song
{
int id;
char name[MAX_SONG_NAME_LENGTH];
char singer[MAX_SINGER_NAME_LENGTH];
genreType genre;
int year;
struct Song* next;
};
// Function declarati.
PLEASE I need help with my assignment I have to compelet .pdfankit11134
PLEASE, I need help with my assignment. I have to compelet what come after (//TODO: ) LINE
AND IT SHOULD VAILD OUT PUT.
PLEASE, Keep in mind you can not change or add anything, just compelet the //TODO yellow , in
the code. please show me an output once you finish I wpuld be thankfull
****************************************************************************************************************
***************** THE CODE
****************************************************************************************************************
****************THE END OF THE CODE
I/ Enter your name here // You are given a partially completed program that creates a list of songs,
like a music repository. // Each song has this information: song's id, song's name, singer's name,
genre of the song, and its published year. // The struct "musicrepository" holds information of one
song. Genre is enum type. // An array of structs called 'tist' is made to hold the list of songs. // To
begin, you should trace through the given code and understand how it works. // Please read the
instructions above each resquired function and follow the directions carefully. // You should not
modify any of the given code, the return types, or the parameters, you will risk of getting
compilation error. 1/ You are not allowed to modify main (). I/ you can use string library functions. //
WRITE COMMENTS FOR IMPORTANT STEPS IN YOUR CODE. #include #include astdlib,h>
Hinclude #pragma warning(disable : 4996) // for visual studio only Wdefine MAX_SONGS 20
Wdefine MAX_SONG_NAME_LENGTH 40 #defIne MAX_SINGER_NAME_LENGTH 40 typedef
enum { unc lassified =0, Pop, Rock, Reggae, country, Blues, Balad, 3 genreType; // enum type
struct musicRepository { // struct for song details unsigned int IO; char
songName[MAX_SONG_NAME_LENGTH]; char singerName[MAX_SINGER_NAME_LENGTH];
genreType genre; unsigned int year; 3 ; struct musicRepository list[MAX_SONGS]; // declare the
list of songs int numsongs = 0; / / the number of songs currently stored in the list (initialized to 0 ) //
Given functions void initializerepository(struct musicrepository repo[], int size); void
printrepository(struct musicrepository repo[], int numsongs); void flushsngin(); // functions that
need to be implemented by you int addsong(struct musickepository repo[], char *songName, char
*singername, char// This function is used to add a song into the list. You can simply add the new
song to the end of list (array of structs). // Do not allow the song to be added to the list if it already
exists in the list. You can do that by checking song names OR IDs already in the list. // If the song
already exists then return without adding it to the list. If the song does not exist in the list then add
the song at the end of the list and return 1. // If song list is full, then do not add new song to the list
and return 2. // The list should be case sensitive. For instance, "Case' and "case" should be
considered two different names. int addSong(str.
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdfarenamobiles123
8.15 Program: Playlist (C++) You will be building a linked list. Make sure to keep track of both
the head and tail nodes. (1) Create three files to submit. Playlist.h - Class declaration Playlist.cpp
- Class definition main.cpp - main() function Build the PlaylistNode class per the following
specifications. Note: Some functions can initially be function stubs (empty functions), to be
completed in later steps. Default constructor (1 pt) Parameterized constructor (1 pt) Public
member functions InsertAfter() (1 pt) SetNext() - Mutator (1 pt) GetID() - Accessor
GetSongName() - Accessor GetArtistName() - Accessor GetSongLength() - Accessor GetNext()
- Accessor PrintPlaylistNode() Private data members string uniqueID - Initialized to \"none\" in
default constructor string songName - Initialized to \"none\" in default constructor string
artistName - Initialized to \"none\" in default constructor int songLength - Initialized to 0 in
default constructor PlaylistNode* nextNodePtr - Initialized to 0 in default constructor Ex. of
PrintPlaylistNode output: Unique ID: S123 Song Name: Peg Artist Name: Steely Dan Song
Length (in seconds): 237 (2) In main(), prompt the user for the title of the playlist. (1 pt) Ex:
Enter playlist\'s title: JAMZ (3) Implement the PrintMenu() function. PrintMenu() takes the
playlist title as a parameter and outputs a menu of options to manipulate the playlist. Each option
is represented by a single character. Build and output the menu within the function. If an invalid
character is entered, continue to prompt for a valid choice. Hint: Implement Quit before
implementing other options. Call PrintMenu() in the main() function. Continue to execute the
menu until the user enters q to Quit. (3 pts) Ex: JAMZ PLAYLIST MENU a - Add song d -
Remove song c - Change position of song s - Output songs by specific artist t - Output total time
of playlist (in seconds) o - Output full playlist q - Quit Choose an option: (4) Implement \"Output
full playlist\" menu option. If the list is empty, output: Playlist is empty (3 pts) Ex: JAMZ -
OUTPUT FULL PLAYLIST 1. Unique ID: SD123 Song Name: Peg Artist Name: Steely Dan
Song Length (in seconds): 237 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet
Jackson Song Length (in seconds): 391 3. Unique ID: J345 Song Name: Canned Heat Artist
Name: Jamiroquai Song Length (in seconds): 330 4. Unique ID: JJ456 Song Name: Black Eagle
Artist Name: Janet Jackson Song Length (in seconds): 197 5. Unique ID: SD567 Song Name: I
Got The News Artist Name: Steely Dan Song Length (in seconds): 306 (5) Implement the \"Add
song\" menu item. New additions are added to the end of the list. (2 pts) Ex: ADD SONG Enter
song\'s unique ID: SD123 Enter song\'s name: Peg Enter artist\'s name: Steely Dan Enter song\'s
length (in seconds): 237 (6) Implement the \"Remove song\" function. Prompt the user for the
unique ID of the song to be removed.(4 pts) Ex: REMOVE SONG Enter song\'s unique ID:
JJ234 \"All For You\" remove.
Program 02 Based on the previous problem you should impleme.pdfaddtechglobalmarketi
Program 02
Based on the previous problem, you should implement this second problem in the same file a05.c.
Find the places in the code marked with the ToDo label and complete the work. You should not
change any other part of the code. This includes do not add any global variables or any other
function. For this problem, we are reusing the same struct from problem 1, but adding a pointer to
the struct to be able to create a linked list. In this problem, you must use linked list to create a user
playlist (play_list).
The struct is holding the information of a song: ID, Name, Singer, Genre, Year, and the pointer
Next (the pointer to the struct).
There should be the following functions. In the similar way we have done in previous assignments,
complete the following functions:
Add a song to the play_list - always inserted at the end of the list. Search song by name - given
the name of the song, return the struct with the data of the song.
Edit a song - given the name of the song, find it in the play_list and modify any of the fields of the
song (ID cannot be edited, and all fields should have a valid value). Return -1 if the song was not
found.
Delete a song - given the name of the song, find it, delete the song from the play_list (i.e.,
disconnect the node from the list). Return -1 if the song was not found, 1 if it was deleted.
// Problem 2
// struct to hold information about a song
struct Song
{
int id;
char name[MAX_SONG_NAME_LENGTH];
char singer[MAX_SINGER_NAME_LENGTH];
genreType genre;
int year;
struct Song *next;
};
// Function declarations
struct Song *createSong(int id, char *name, char *singer, char *genre, int year);
void printPlaylist(struct Song *playlist);
void add_song(struct Song **playlist, struct Song *newSong);
struct Song *search_song(struct Song *playlist, char *name);
int edit_song(struct Song *playlist, char *name, char *singer, char *genre, int
year);
int delete_song(struct Song *playlist, char *name);
// function to create a new song
struct Song *createSong(int id, char *name, char *singer, char *genre, int year)
{
struct Song *newSong = (struct Song *)malloc(sizeof(struct Song));
newSong->id = id;
strcpy(newSong->name, name);
strcpy(newSong->singer, singer);
if (strcmp(genre, "Pop") == 0)
newSong->genre = 1;
else if (strcmp(genre, "Rock") == 0)
newSong->genre = 2;
else if (strcmp(genre, "Reggae") == 0)
newSong->genre = 3;
else if (strcmp(genre, "Country") == 0)
newSong->genre = 4;
else if (strcmp(genre, "Blues") == 0)
newSong->genre = 5;
else if (strcmp(genre, "Balad") == 0)
newSong->genre = 6;
else
newSong->genre = 0;
newSong->year = year;
newSong->next = NULL;
return newSong;
}
// function to print the playlist
void printPlaylist(struct Song *playlist)
{
struct Song *current = playlist;
while (current != NULL)
{
printf("%dt%st%st%dt%dn", current->id, current->name, current->singer,
current->genre, current->year);
current = current->next;
}
}
// function to add a song to the end of the playlist
void add_song(struct Song .
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdfARCHANASTOREKOTA
8.8 Program: Playlist (Java)
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create two files to submit.
SongEntry.java - Class declaration
Playlist.java - Contains main() method
Build the SongEntry class per the following specifications. Note: Some methods can initially be
method stubs (empty methods), to be completed in later steps.
Private fields
String uniqueID - Initialized to \"none\" in default constructor
string songName - Initialized to \"none\" in default constructor
string artistName - Initialized to \"none\" in default constructor
int songLength - Initialized to 0 in default constructor
SongEntry nextNode - Initialized to null in default constructor
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member methods
insertAfter() (1 pt)
setNext() - Mutator (1 pt)
getID() - Accessor
getSongName() - Accessor
getArtistName() - Accessor
getSongLength() - Accessor
getNext() - Accessor
printPlaylistSongs()
Ex. of printPlaylistSongs output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the printMenu() method. printMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. Each option is represented by a single
character. Build and output the menu within the method.
If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit
before implementing other options. Call printMenu() in the main() method. Continue to execute
the menu until the user enters q to Quit. (3 pts)
Ex:
(4) Implement \"Output full playlist\" menu option. If the list is empty, output: Playlist is empty
(3 pts)
Ex:
(5) Implement the \"Add song\" menu item. New additions are added to the end of the list. (2
pts)
Ex:
(6) Implement the \"Remove song\" method. Prompt the user for the unique ID of the song to be
removed.(4 pts)
Ex:
(7) Implement the \"Change position of song\" menu option. Prompt the user for the current
position of the song and the desired new position. Valid new positions are 1 - n (the number of
nodes). If the user enters a new position that is less than 1, move the node to the position 1 (the
head). If the user enters a new position greater than n, move the node to position n (the tail). 6
cases will be tested:
Moving the head node (1 pt)
Moving the tail node (1 pt)
Moving a node to the head (1 pt)
Moving a node to the tail (1 pt)
Moving a node up the list (1 pt)
Moving a node down the list (1 pt)
Ex:
(8) Implement the \"Output songs by specific artist\" menu option. Prompt the user for the
artist\'s name, and output the node\'s information, starting with the node\'s current position. (2 pt)
Ex:
(9) Implement the \"Output total time of playlist\" menu option. Output the sum of the time of
the playlist\'s songs (in seconds). (2 pts)
Ex:
Solution
SongEntry.java
package playlist;
public class SongEntry {
private String uniqueID;
private String songName;
private String artistName.
It's not working what am I doing wrong- Given main()- complete the Son.pdfaanyajoshi90
It's not working what am I doing wrong?
Given main(), complete the SongNode class to include the printSongInfo() method. Then write
the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
the output is:
import java.util.Scanner;
public class Playlist {
// TODO: Write method to ouptut list of songs
public static void printPlaylist(SongNode songs){
SongNode song = song.getNext();
while (song != null) {
song.printSongInfo();
System.out.println();
song = song.getNext();
}
}
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
songTitle = scnr.nextLine();
while (!songTitle.equals("-1")) {
songLength = scnr.nextInt();
scnr.nextLine();
songArtist = scnr.nextLine();
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode.insertAfter(currNode);
lastNode = currNode;
songTitle = scnr.nextLine();
}
// Print linked list
System.out.println("LIST OF SONGS");
System.out.println("-------------");
printPlaylist(headNode);
}
}
public class SongNode {
private String songTitle;
private int songLength;
private String songArtist;
private SongNode nextNodeRef; // Reference to the next node
public SongNode() {
songTitle = "";
songLength = 0;
songArtist = "";
nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode
nextLoc) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = nextLoc;
}
// insertAfter
public void insertAfter(SongNode nodeLoc) {
SongNode tmpNext;
tmpNext = this.nextNodeRef;
this.nextNodeRef = nodeLoc;
nodeLoc.nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
public SongNode getNext() {
return this.nextNodeRef;
}
// TODO: Write printSongInfo() method
public void printInfo(){
System.out.println("Title: " + songTitle);
System.out.println("Length: " + songLength);
System.out.println("Artist: " + songArtist);
}
}.
Many of us have large digital music collections that are not always .pdffazanmobiles
Many of us have large digital music collections that are not always very well organized. It would
be nice to have a program that would manipulate our music collection based on attributes such as
artist, album title, song title, genre, song length, number times played, and rating. For this
assignment you will write a basic digital music manager (DMM).
Your DMM program must have a text-based interface which allows the user to select from a
mainmenu of options including: (1) load, (2) store, (3) display, (4) insert, (5) delete, (6) edit, (7)
sort, (8) rate, (9) play, (10) shuffle, and (11) exit. For Part I of the assignment, you will only need
to complete the main menu, (1) load, (2) store, (3) display, (6) edit, (8) rate, (9) play, and (11)
exit features. The other features will be completed in the next part of the assignment.
What must the main menu contain?
The main menu must display the following commands:
(1) load
(2) store
(3) display
(4) insert
(5) delete
(6) edit
(7) sort
(8) rate
(9) play
(10) shuffle
(11) exit
After a command is selected and completed, your program must display the main menu again.
This procedure will continue until the “exit” command is selected.
What must “load” do?
The “load” command must read all records from a file called musicPlayList.csv (you may find a
sample file here) into a dynamic doubly linked list. The doubly linked list is considered the main
playlist. As each record is read from the file, it must be inserted at the front of the list. Each
record consists of the following attributes:
Each attribute, in a single record, will be separated by a comma in the .csv (comma separated
values) file. This means that you will need to design an algorithm to extract the required
attributes for each record. Each field in each record will have a value. You do not need to check
for null or empty values.
You must define a struct called Record to represent the above attributes. Also, do not forget that
the Song Length must be represented by another struct called Duration. Duration is defined as
follows:
Finally, each struct Node in the doubly linked list must be defined as follows:
What must “store” do?
The “store” command writes the current records, in the dynamic doubly linked list, to the
musicPlayList.csv file. The store will completely overwrite the previous contents in the file.
What must “display” do?
The “display” command prints records to the screen. This command must support two methods,
one of which is selected by the user:
Print all records.
Print all records that match an artist.
What must “edit” do?
The “edit” command must allow the user to find a record in the list by artist. If there are multiple
records with the same artist, then your program must prompt the user which one to edit. The user
may modify all of the attributes in the record.
What must “rate” do?
The “rate” command must allow the user to assign a value of 1 – 5 to a song; 1 is the lowest
rating and 5 is the highest rating. The rating will repla.
1817 LAB Playlist output linked list Given main compl.pdfspshotham
18.17 LAB: Playlist (output linked list)
Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write the
PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the dummy
head node.
Ex: If the input is:
the output is:
#include "SongNode.h"
// Constructor
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit) {
this->songTitle = songTitleInit;
this->songLength = songLengthInit;
this->songArtist = songArtistInit;
this->nextNodeRef = NULL;
}
// Constructor
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode*
nextLoc) {
this->songTitle = songTitleInit;
this->songLength = songLengthInit;
this->songArtist = songArtistInit;
this->nextNodeRef = nextLoc;
}
// insertAfter
void SongNode::InsertAfter(SongNode* nodeLoc) {
SongNode* tmpNext;
tmpNext = this->nextNodeRef;
this->nextNodeRef = nodeLoc;
nodeLoc->nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
SongNode* SongNode::GetNext() {
return this->nextNodeRef;
}
// TODO: Write PrintSongInfo() function
in C++ please, thank you!.
Given main(), complete the SongNode class to include the printSong.pdfillyasraja7
Given main(), complete the SongNode class to include the printSongInfo() method. Then write
the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
Stomp!
380
The Brothers Johnson
The Dude
337
Quincy Jones
You Don't Own Me
151
Lesley Gore
-1
the output is:
LIST OF SONGS
-------------
Title: Stomp!
Length: 380
Artist: The Brothers Johnson
Title: The Dude
Length: 337
Artist: Quincy Jones
Title: You Don't Own Me
Length: 151
Artist: Lesley Gore
PLAYLIST.JAVA
import java.util.Scanner;
public class Playlist {
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
songTitle = scnr.nextLine();
while (!songTitle.equals("-1")) {
songLength = scnr.nextInt();
scnr.nextLine();
songArtist = scnr.nextLine();
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode.insertAfter(currNode);
lastNode = currNode;
songTitle = scnr.nextLine();
}
// Print linked list
System.out.println("LIST OF SONGS");
System.out.println("-------------");
printPlaylist(headNode);
}
}
SONGNODE.JAVA
public class SongNode {
private String songTitle;
private int songLength;
private String songArtist;
private SongNode nextNodeRef; // Reference to the next node
public SongNode() {
songTitle = "";
songLength = 0;
songArtist = "";
nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode
nextLoc) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = nextLoc;
}
// insertAfter
public void insertAfter(SongNode nodeLoc) {
SongNode tmpNext;
tmpNext = this.nextNodeRef;
this.nextNodeRef = nodeLoc;
nodeLoc.nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
public SongNode getNext() {
return this.nextNodeRef;
}
// TODO: Write printSongInfo() method
}.
You are required to implement all the classes as specified by UML di.pdfarorasales234
You are required to implement all the classes as specified by UML diagram below.The objective
of most of the methods is obvious from the given method name and input parameters.I am listing
below the explanation of the not-so-obvious methods.
PlayList Class:
getSong(pos:int) :Song
a method that returns the song that is located in the given position (pos). If there is no song in the
given position then the method returns null
getSongPosition(title:String):int
a method that takes the song title as input and returns as output the position of the song in the
list. If not found, the method returns -1. Song -title:String -artist: String +Song (title:String,
artist:String) +gettitle ():String +getArtist ):String +tostring ) :String PlayList
maxNumOfSongs:int -currentNumor Songs: int; +PlayList (maxNumOESongs:int)
+getcurrentNumSongs ) :int +addsong (title:String, artist:String) :void +addsong
(song:Song):void +getsong (pos:int) :Song +getsongPosition (title:String) :int User nam String -
favoriteSongs: PlayList +User (name: String, favoriteSongs: PlayList) +User (name: String)
+setFavoriteSongs (1ist: PlayList) :void +getFavoriteSongs) PlayList; +getsong (title:String)
:Song +addsong (title:String, artist:String) :void tartistsongCount (artist:String) :int +tostring ()
:String
Solution
Please find the implementation of all the classes mentioned in the above UML diagram. Please
see comment against each line to get to know the explanation :.
In C++ please I need output please You will be building a .pdfsunilverma8487
In C++ please I need output please
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create three files to submit.
PlaylistNode.h - Class declaration
PlaylistNode.cpp - Class definition
main.cpp - main() function
Build the PlaylistNode class per the following specifications. Note: Some functions can initially be
function stubs (empty functions), to be completed in later steps.
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member functions
InsertAfter() - Mutator (1 pt)
SetNext() - Mutator (1 pt)
GetID() - Accessor
GetSongName() - Accessor
GetArtistName() - Accessor
GetSongLength() - Accessor
GetNext() - Accessor
PrintPlaylistNode()
Private data members
string uniqueID - Initialized to "none" in default constructor
string songName - Initialized to "none" in default constructor
string artistName - Initialized to "none" in default constructor
int songLength - Initialized to 0 in default constructor
PlaylistNode* nextNodePtr - Initialized to 0 in default constructor
Ex. of PrintPlaylistNode output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. (1 pt)
Ex:
(4) Implement the ExecuteMenu() function that takes 3 parameters: a character representing the
user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu()
performs the menu options (described below) according to the user's choice, and returns the
pointer to the head node of the playlist.(1 pt)
(5) In main(), call PrintMenu() and prompt for the user's choice of menu options. Each option is
represented by a single character.
If an invalid character is entered, continue to prompt for a valid choice. When a valid option is
entered, execute the option by calling ExecuteMenu() and overwrite the pointer to the head node
of the playlist with the returned pointer. Then, print the menu, and prompt for a new option.
Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt)
Ex:
(6) Implement "Output full playlist" menu option in ExecuteMenu(). If the list is empty, output:
Playlist is empty (3 pts)
Ex:
(7) Implement the "Add song" menu option in ExecuteMenu(). New additions are added to the end
of the list. (2 pts)
Ex:
(8) Implement the "Remove song" menu option in ExecuteMenu(). Prompt the user for the unique
ID of the song to be removed.(4 pts)
Ex:
(9) Implement the "Change position of song" menu option in ExecuteMenu(). Prompt the user for
the current position of the song and the desired new position. Valid new positions are 1 - n (the
number of nodes). If the user enters a new position that is less than 1, move the node to the
position 1 (the head). If the user enters a new position greater than n, move the node to position n
(the tail). 6 cases will be tested:
Moving the head node (1 pt)
.
In C++ Plz LAB- Playlist (output linked list) Given main()- complete.pdfshreeaadithyaacellso
In C++ Plz
LAB: Playlist (output linked list)
Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write
the PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
the output is:
main.cpp Default Code:
#include <iostream>
#include "SongNode.h"
// TODO: Write PrintPlaylist() function
int main() {
SongNode* headNode;
SongNode* currNode;
SongNode* lastNode;
string songTitle;
string songLength;
string songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
getline(cin, songTitle);
while (songTitle != "-1") {
getline(cin, songLength);
getline(cin, songArtist);
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode->InsertAfter(currNode);
lastNode = currNode;
getline(cin, songTitle);
}
// Print linked list
cout << "LIST OF SONGS" << endl;
cout << "-------------" << endl;
PrintPlaylist(headNode);
return 0;
}.
819 LAB Program Playlist c++ You will be building a li.pdfmeenaaarika
8.19 LAB*: Program: Playlist (c++)
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create three files to submit.
PlaylistNode.h - Class declaration
PlaylistNode.cpp - Class definition
main.cpp - main() function
Build the PlaylistNode class per the following specifications. Note: Some functions can initially be
function stubs (empty functions), to be completed in later steps.
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member functions
InsertAfter() - Mutator (1 pt)
SetNext() - Mutator (1 pt)
GetID() - Accessor
GetSongName() - Accessor
GetArtistName() - Accessor
GetSongLength() - Accessor
GetNext() - Accessor
PrintPlaylistNode()
Private data members
string uniqueID - Initialized to "none" in default constructor
string songName - Initialized to "none" in default constructor
string artistName - Initialized to "none" in default constructor
int songLength - Initialized to 0 in default constructor
PlaylistNode* nextNodePtr - Initialized to 0 in default constructor
Ex. of PrintPlaylistNode output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. (1 pt)
Ex:
(4) Implement the ExecuteMenu() function that takes 3 parameters: a character representing the
user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu()
performs the menu options (described below) according to the user's choice, and returns the
pointer to the head node of the playlist.(1 pt)
(5) In main(), call PrintMenu() and prompt for the user's choice of menu options. Each option is
represented by a single character.
If an invalid character is entered, continue to prompt for a valid choice. When a valid option is
entered, execute the option by calling ExecuteMenu() and overwrite the pointer to the head node
of the playlist with the returned pointer. Then, print the menu, and prompt for a new option.
Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt)
Ex:
(6) Implement "Output full playlist" menu option in ExecuteMenu(). If the list is empty, output:
Playlist is empty (3 pts)
Ex:
(7) Implement the "Add song" menu option in ExecuteMenu(). New additions are added to the end
of the list. (2 pts)
Ex:
(8) Implement the "Remove song" menu option in ExecuteMenu(). Prompt the user for the unique
ID of the song to be removed.(4 pts)
Ex:
(9) Implement the "Change position of song" menu option in ExecuteMenu(). Prompt the user for
the current position of the song and the desired new position. Valid new positions are 1 - n (the
number of nodes). If the user enters a new position that is less than 1, move the node to the
position 1 (the head). If the user enters a new position greater than n, move the node to position n
(the tail). 6 cases will be tested:
Moving the head node (1 pt)
.
The provided codetrack_file_handling.rb class Track att.pdffashination
The provided code:
*track_file_handling.rb
class Track
attr_accessor :name, :location
def initialize (name, location)
@name = name
@location = location
end
end
# Returns an array of tracks read from the given file
def read_tracks(music_file)
count = music_file.gets().to_i()
tracks = Array.new()
# Put a while loop here which increments an index to read the tracks
track = read_track(music_file)
tracks << track
return tracks
end
# reads in a single track from the given file.
def read_track(a_file)
# complete this function
# you need to create a Track here.
end
# Takes an array of tracks and prints them to the terminal
def print_tracks(tracks)
# Use a while loop with a control variable index
# to print each track. Use tracks.length to determine how
# many times to loop.
# Print each track use: tracks[index] to get each track record
end
# Takes a single track and prints it to the terminal
def print_track(track)
puts(track.name)
puts(track.location)
end
# Open the file and read in the tracks then print them
def main()
a_file = File.new("input.txt", "r") # open for reading
# Print all the tracks
print_tracks(tracks)
end
main()
*input.txt
3
Crackling Rose
sounds/01-Cracklin-rose.wav
Soolaimon
sounds/06-Soolaimon.wav
Sweet Caroline
sounds/20-Sweet_Caroline.wav
Can anyone pls help me with this Ruby task, it's urgent. Thx! Use the code provided to get
started. You must enhance the code provided as follows: - Complete the provided code so that it
reads in an array of tracks then prints them out. The program output (using the file input.txt)
should look as follows: MacBook-Pro-6:TuteTasks mmitchel1s ruby music_tracks_only.rb
Crackling Rose sounds/01-Cracklin-rose.wav Soolaimon sounds/06-Soolaimon.wav Sweet
Caroline sounds/20-Sweet_Caroline.wav MacBook-Pro-6:TuteTasks mmitchel1s Once your
program is running upload a screenshot to the workspace. Below is a structure chart for this task:.
How do autopolyploidy and allopolyploidy differ Only autopolyploidy.pdfarihanthtextiles
How do autopolyploidy and allopolyploidy differ? Only autopolyploidy involves an increase in
chromosome sets. The chromosomes of an autopolyploid individual come from the same
species, while an allopolyploid has sets of chromosomes from different species. Autopolyploidy
is a mechanism of speciation in plants, while allopolyploid is a mechanism of speciation animals.
Autopolyploidy is sympatric, while allopolyploidy is allopatric.
Solution
Answer:
b). The chromosomes of an autopolyploid individual come from the same species, while an
allopolyploid has sets of chromsomes from different species
Autopolyploidy arises from fusion of gametes of the same species (cell division errors, etc.). In
this process, polyploid individuals develop as a result of cell division errors that double the DNA
content of gametes in individuals from the same species or a self-fertilizing individual. When
these double-dose gametes fuse, the result is an organism with double the chromosome number
of its parent species.
Allopolyploidy occurs when the gametes from two species fuse to form a polyploid generation
and hybrid offspring..
How do you find the order of growth for the following recurrenceT.pdfarihanthtextiles
How do you find the order of growth for the following recurrence?
T(n) = 9T(n/3) + n2
Solution
The Master Theorem applies to recurrences of the following form:
T (n) = aT (n/b) + f (n)
where a 1 and b > 1 are constants and f (n) is an asymptotically positive function.
There are 3 cases:
Case First:-- f(n) is O(nlogba ). Since the leaves grow faster than f, all work is done at the
leaves, so T(n) is (nlogb a).
Case Second:-- f(n) is (nlogba). The leaves grow at same rate as f, so the same order of work is
done at every level of tree. Therfore tree has O(log n) levels times the work done on one level,
yielding T(n) is (nlogb a log n).
Case Third:-- f(n) is (nlogba + ). Here f grows faster than the number of leaves, which means that
asymptotically the total amount of work is dominated by the work done at the root node. For the
upper bound, we also need an extra smoothness condition on f in this case i.e af(n/b) cf(n) for
some constant c < 1 and large n. In this case T(n) is (f(n)).
Therefore, using Master Method on your above Question
a=9, b=3, =log39 = 2, f(n) = n2, so Case 2, i.e. T(n) = (nlogn) = (n2logn)..
More Related Content
Similar to I need help writing the methods for the song and playList class in J.pdf
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdfARCHANASTOREKOTA
8.8 Program: Playlist (Java)
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create two files to submit.
SongEntry.java - Class declaration
Playlist.java - Contains main() method
Build the SongEntry class per the following specifications. Note: Some methods can initially be
method stubs (empty methods), to be completed in later steps.
Private fields
String uniqueID - Initialized to \"none\" in default constructor
string songName - Initialized to \"none\" in default constructor
string artistName - Initialized to \"none\" in default constructor
int songLength - Initialized to 0 in default constructor
SongEntry nextNode - Initialized to null in default constructor
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member methods
insertAfter() (1 pt)
setNext() - Mutator (1 pt)
getID() - Accessor
getSongName() - Accessor
getArtistName() - Accessor
getSongLength() - Accessor
getNext() - Accessor
printPlaylistSongs()
Ex. of printPlaylistSongs output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the printMenu() method. printMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. Each option is represented by a single
character. Build and output the menu within the method.
If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit
before implementing other options. Call printMenu() in the main() method. Continue to execute
the menu until the user enters q to Quit. (3 pts)
Ex:
(4) Implement \"Output full playlist\" menu option. If the list is empty, output: Playlist is empty
(3 pts)
Ex:
(5) Implement the \"Add song\" menu item. New additions are added to the end of the list. (2
pts)
Ex:
(6) Implement the \"Remove song\" method. Prompt the user for the unique ID of the song to be
removed.(4 pts)
Ex:
(7) Implement the \"Change position of song\" menu option. Prompt the user for the current
position of the song and the desired new position. Valid new positions are 1 - n (the number of
nodes). If the user enters a new position that is less than 1, move the node to the position 1 (the
head). If the user enters a new position greater than n, move the node to position n (the tail). 6
cases will be tested:
Moving the head node (1 pt)
Moving the tail node (1 pt)
Moving a node to the head (1 pt)
Moving a node to the tail (1 pt)
Moving a node up the list (1 pt)
Moving a node down the list (1 pt)
Ex:
(8) Implement the \"Output songs by specific artist\" menu option. Prompt the user for the
artist\'s name, and output the node\'s information, starting with the node\'s current position. (2 pt)
Ex:
(9) Implement the \"Output total time of playlist\" menu option. Output the sum of the time of
the playlist\'s songs (in seconds). (2 pts)
Ex:
Solution
SongEntry.java
package playlist;
public class SongEntry {
private String uniqueID;
private String songName;
private String artistName.
It's not working what am I doing wrong- Given main()- complete the Son.pdfaanyajoshi90
It's not working what am I doing wrong?
Given main(), complete the SongNode class to include the printSongInfo() method. Then write
the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
the output is:
import java.util.Scanner;
public class Playlist {
// TODO: Write method to ouptut list of songs
public static void printPlaylist(SongNode songs){
SongNode song = song.getNext();
while (song != null) {
song.printSongInfo();
System.out.println();
song = song.getNext();
}
}
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
songTitle = scnr.nextLine();
while (!songTitle.equals("-1")) {
songLength = scnr.nextInt();
scnr.nextLine();
songArtist = scnr.nextLine();
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode.insertAfter(currNode);
lastNode = currNode;
songTitle = scnr.nextLine();
}
// Print linked list
System.out.println("LIST OF SONGS");
System.out.println("-------------");
printPlaylist(headNode);
}
}
public class SongNode {
private String songTitle;
private int songLength;
private String songArtist;
private SongNode nextNodeRef; // Reference to the next node
public SongNode() {
songTitle = "";
songLength = 0;
songArtist = "";
nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode
nextLoc) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = nextLoc;
}
// insertAfter
public void insertAfter(SongNode nodeLoc) {
SongNode tmpNext;
tmpNext = this.nextNodeRef;
this.nextNodeRef = nodeLoc;
nodeLoc.nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
public SongNode getNext() {
return this.nextNodeRef;
}
// TODO: Write printSongInfo() method
public void printInfo(){
System.out.println("Title: " + songTitle);
System.out.println("Length: " + songLength);
System.out.println("Artist: " + songArtist);
}
}.
Many of us have large digital music collections that are not always .pdffazanmobiles
Many of us have large digital music collections that are not always very well organized. It would
be nice to have a program that would manipulate our music collection based on attributes such as
artist, album title, song title, genre, song length, number times played, and rating. For this
assignment you will write a basic digital music manager (DMM).
Your DMM program must have a text-based interface which allows the user to select from a
mainmenu of options including: (1) load, (2) store, (3) display, (4) insert, (5) delete, (6) edit, (7)
sort, (8) rate, (9) play, (10) shuffle, and (11) exit. For Part I of the assignment, you will only need
to complete the main menu, (1) load, (2) store, (3) display, (6) edit, (8) rate, (9) play, and (11)
exit features. The other features will be completed in the next part of the assignment.
What must the main menu contain?
The main menu must display the following commands:
(1) load
(2) store
(3) display
(4) insert
(5) delete
(6) edit
(7) sort
(8) rate
(9) play
(10) shuffle
(11) exit
After a command is selected and completed, your program must display the main menu again.
This procedure will continue until the “exit” command is selected.
What must “load” do?
The “load” command must read all records from a file called musicPlayList.csv (you may find a
sample file here) into a dynamic doubly linked list. The doubly linked list is considered the main
playlist. As each record is read from the file, it must be inserted at the front of the list. Each
record consists of the following attributes:
Each attribute, in a single record, will be separated by a comma in the .csv (comma separated
values) file. This means that you will need to design an algorithm to extract the required
attributes for each record. Each field in each record will have a value. You do not need to check
for null or empty values.
You must define a struct called Record to represent the above attributes. Also, do not forget that
the Song Length must be represented by another struct called Duration. Duration is defined as
follows:
Finally, each struct Node in the doubly linked list must be defined as follows:
What must “store” do?
The “store” command writes the current records, in the dynamic doubly linked list, to the
musicPlayList.csv file. The store will completely overwrite the previous contents in the file.
What must “display” do?
The “display” command prints records to the screen. This command must support two methods,
one of which is selected by the user:
Print all records.
Print all records that match an artist.
What must “edit” do?
The “edit” command must allow the user to find a record in the list by artist. If there are multiple
records with the same artist, then your program must prompt the user which one to edit. The user
may modify all of the attributes in the record.
What must “rate” do?
The “rate” command must allow the user to assign a value of 1 – 5 to a song; 1 is the lowest
rating and 5 is the highest rating. The rating will repla.
1817 LAB Playlist output linked list Given main compl.pdfspshotham
18.17 LAB: Playlist (output linked list)
Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write the
PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the dummy
head node.
Ex: If the input is:
the output is:
#include "SongNode.h"
// Constructor
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit) {
this->songTitle = songTitleInit;
this->songLength = songLengthInit;
this->songArtist = songArtistInit;
this->nextNodeRef = NULL;
}
// Constructor
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode*
nextLoc) {
this->songTitle = songTitleInit;
this->songLength = songLengthInit;
this->songArtist = songArtistInit;
this->nextNodeRef = nextLoc;
}
// insertAfter
void SongNode::InsertAfter(SongNode* nodeLoc) {
SongNode* tmpNext;
tmpNext = this->nextNodeRef;
this->nextNodeRef = nodeLoc;
nodeLoc->nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
SongNode* SongNode::GetNext() {
return this->nextNodeRef;
}
// TODO: Write PrintSongInfo() function
in C++ please, thank you!.
Given main(), complete the SongNode class to include the printSong.pdfillyasraja7
Given main(), complete the SongNode class to include the printSongInfo() method. Then write
the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
Stomp!
380
The Brothers Johnson
The Dude
337
Quincy Jones
You Don't Own Me
151
Lesley Gore
-1
the output is:
LIST OF SONGS
-------------
Title: Stomp!
Length: 380
Artist: The Brothers Johnson
Title: The Dude
Length: 337
Artist: Quincy Jones
Title: You Don't Own Me
Length: 151
Artist: Lesley Gore
PLAYLIST.JAVA
import java.util.Scanner;
public class Playlist {
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
songTitle = scnr.nextLine();
while (!songTitle.equals("-1")) {
songLength = scnr.nextInt();
scnr.nextLine();
songArtist = scnr.nextLine();
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode.insertAfter(currNode);
lastNode = currNode;
songTitle = scnr.nextLine();
}
// Print linked list
System.out.println("LIST OF SONGS");
System.out.println("-------------");
printPlaylist(headNode);
}
}
SONGNODE.JAVA
public class SongNode {
private String songTitle;
private int songLength;
private String songArtist;
private SongNode nextNodeRef; // Reference to the next node
public SongNode() {
songTitle = "";
songLength = 0;
songArtist = "";
nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode
nextLoc) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = nextLoc;
}
// insertAfter
public void insertAfter(SongNode nodeLoc) {
SongNode tmpNext;
tmpNext = this.nextNodeRef;
this.nextNodeRef = nodeLoc;
nodeLoc.nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
public SongNode getNext() {
return this.nextNodeRef;
}
// TODO: Write printSongInfo() method
}.
You are required to implement all the classes as specified by UML di.pdfarorasales234
You are required to implement all the classes as specified by UML diagram below.The objective
of most of the methods is obvious from the given method name and input parameters.I am listing
below the explanation of the not-so-obvious methods.
PlayList Class:
getSong(pos:int) :Song
a method that returns the song that is located in the given position (pos). If there is no song in the
given position then the method returns null
getSongPosition(title:String):int
a method that takes the song title as input and returns as output the position of the song in the
list. If not found, the method returns -1. Song -title:String -artist: String +Song (title:String,
artist:String) +gettitle ():String +getArtist ):String +tostring ) :String PlayList
maxNumOfSongs:int -currentNumor Songs: int; +PlayList (maxNumOESongs:int)
+getcurrentNumSongs ) :int +addsong (title:String, artist:String) :void +addsong
(song:Song):void +getsong (pos:int) :Song +getsongPosition (title:String) :int User nam String -
favoriteSongs: PlayList +User (name: String, favoriteSongs: PlayList) +User (name: String)
+setFavoriteSongs (1ist: PlayList) :void +getFavoriteSongs) PlayList; +getsong (title:String)
:Song +addsong (title:String, artist:String) :void tartistsongCount (artist:String) :int +tostring ()
:String
Solution
Please find the implementation of all the classes mentioned in the above UML diagram. Please
see comment against each line to get to know the explanation :.
In C++ please I need output please You will be building a .pdfsunilverma8487
In C++ please I need output please
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create three files to submit.
PlaylistNode.h - Class declaration
PlaylistNode.cpp - Class definition
main.cpp - main() function
Build the PlaylistNode class per the following specifications. Note: Some functions can initially be
function stubs (empty functions), to be completed in later steps.
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member functions
InsertAfter() - Mutator (1 pt)
SetNext() - Mutator (1 pt)
GetID() - Accessor
GetSongName() - Accessor
GetArtistName() - Accessor
GetSongLength() - Accessor
GetNext() - Accessor
PrintPlaylistNode()
Private data members
string uniqueID - Initialized to "none" in default constructor
string songName - Initialized to "none" in default constructor
string artistName - Initialized to "none" in default constructor
int songLength - Initialized to 0 in default constructor
PlaylistNode* nextNodePtr - Initialized to 0 in default constructor
Ex. of PrintPlaylistNode output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. (1 pt)
Ex:
(4) Implement the ExecuteMenu() function that takes 3 parameters: a character representing the
user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu()
performs the menu options (described below) according to the user's choice, and returns the
pointer to the head node of the playlist.(1 pt)
(5) In main(), call PrintMenu() and prompt for the user's choice of menu options. Each option is
represented by a single character.
If an invalid character is entered, continue to prompt for a valid choice. When a valid option is
entered, execute the option by calling ExecuteMenu() and overwrite the pointer to the head node
of the playlist with the returned pointer. Then, print the menu, and prompt for a new option.
Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt)
Ex:
(6) Implement "Output full playlist" menu option in ExecuteMenu(). If the list is empty, output:
Playlist is empty (3 pts)
Ex:
(7) Implement the "Add song" menu option in ExecuteMenu(). New additions are added to the end
of the list. (2 pts)
Ex:
(8) Implement the "Remove song" menu option in ExecuteMenu(). Prompt the user for the unique
ID of the song to be removed.(4 pts)
Ex:
(9) Implement the "Change position of song" menu option in ExecuteMenu(). Prompt the user for
the current position of the song and the desired new position. Valid new positions are 1 - n (the
number of nodes). If the user enters a new position that is less than 1, move the node to the
position 1 (the head). If the user enters a new position greater than n, move the node to position n
(the tail). 6 cases will be tested:
Moving the head node (1 pt)
.
In C++ Plz LAB- Playlist (output linked list) Given main()- complete.pdfshreeaadithyaacellso
In C++ Plz
LAB: Playlist (output linked list)
Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write
the PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
the output is:
main.cpp Default Code:
#include <iostream>
#include "SongNode.h"
// TODO: Write PrintPlaylist() function
int main() {
SongNode* headNode;
SongNode* currNode;
SongNode* lastNode;
string songTitle;
string songLength;
string songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
getline(cin, songTitle);
while (songTitle != "-1") {
getline(cin, songLength);
getline(cin, songArtist);
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode->InsertAfter(currNode);
lastNode = currNode;
getline(cin, songTitle);
}
// Print linked list
cout << "LIST OF SONGS" << endl;
cout << "-------------" << endl;
PrintPlaylist(headNode);
return 0;
}.
819 LAB Program Playlist c++ You will be building a li.pdfmeenaaarika
8.19 LAB*: Program: Playlist (c++)
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create three files to submit.
PlaylistNode.h - Class declaration
PlaylistNode.cpp - Class definition
main.cpp - main() function
Build the PlaylistNode class per the following specifications. Note: Some functions can initially be
function stubs (empty functions), to be completed in later steps.
Default constructor (1 pt)
Parameterized constructor (1 pt)
Public member functions
InsertAfter() - Mutator (1 pt)
SetNext() - Mutator (1 pt)
GetID() - Accessor
GetSongName() - Accessor
GetArtistName() - Accessor
GetSongLength() - Accessor
GetNext() - Accessor
PrintPlaylistNode()
Private data members
string uniqueID - Initialized to "none" in default constructor
string songName - Initialized to "none" in default constructor
string artistName - Initialized to "none" in default constructor
int songLength - Initialized to 0 in default constructor
PlaylistNode* nextNodePtr - Initialized to 0 in default constructor
Ex. of PrintPlaylistNode output:
(2) In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
(3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and
outputs a menu of options to manipulate the playlist. (1 pt)
Ex:
(4) Implement the ExecuteMenu() function that takes 3 parameters: a character representing the
user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu()
performs the menu options (described below) according to the user's choice, and returns the
pointer to the head node of the playlist.(1 pt)
(5) In main(), call PrintMenu() and prompt for the user's choice of menu options. Each option is
represented by a single character.
If an invalid character is entered, continue to prompt for a valid choice. When a valid option is
entered, execute the option by calling ExecuteMenu() and overwrite the pointer to the head node
of the playlist with the returned pointer. Then, print the menu, and prompt for a new option.
Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt)
Ex:
(6) Implement "Output full playlist" menu option in ExecuteMenu(). If the list is empty, output:
Playlist is empty (3 pts)
Ex:
(7) Implement the "Add song" menu option in ExecuteMenu(). New additions are added to the end
of the list. (2 pts)
Ex:
(8) Implement the "Remove song" menu option in ExecuteMenu(). Prompt the user for the unique
ID of the song to be removed.(4 pts)
Ex:
(9) Implement the "Change position of song" menu option in ExecuteMenu(). Prompt the user for
the current position of the song and the desired new position. Valid new positions are 1 - n (the
number of nodes). If the user enters a new position that is less than 1, move the node to the
position 1 (the head). If the user enters a new position greater than n, move the node to position n
(the tail). 6 cases will be tested:
Moving the head node (1 pt)
.
The provided codetrack_file_handling.rb class Track att.pdffashination
The provided code:
*track_file_handling.rb
class Track
attr_accessor :name, :location
def initialize (name, location)
@name = name
@location = location
end
end
# Returns an array of tracks read from the given file
def read_tracks(music_file)
count = music_file.gets().to_i()
tracks = Array.new()
# Put a while loop here which increments an index to read the tracks
track = read_track(music_file)
tracks << track
return tracks
end
# reads in a single track from the given file.
def read_track(a_file)
# complete this function
# you need to create a Track here.
end
# Takes an array of tracks and prints them to the terminal
def print_tracks(tracks)
# Use a while loop with a control variable index
# to print each track. Use tracks.length to determine how
# many times to loop.
# Print each track use: tracks[index] to get each track record
end
# Takes a single track and prints it to the terminal
def print_track(track)
puts(track.name)
puts(track.location)
end
# Open the file and read in the tracks then print them
def main()
a_file = File.new("input.txt", "r") # open for reading
# Print all the tracks
print_tracks(tracks)
end
main()
*input.txt
3
Crackling Rose
sounds/01-Cracklin-rose.wav
Soolaimon
sounds/06-Soolaimon.wav
Sweet Caroline
sounds/20-Sweet_Caroline.wav
Can anyone pls help me with this Ruby task, it's urgent. Thx! Use the code provided to get
started. You must enhance the code provided as follows: - Complete the provided code so that it
reads in an array of tracks then prints them out. The program output (using the file input.txt)
should look as follows: MacBook-Pro-6:TuteTasks mmitchel1s ruby music_tracks_only.rb
Crackling Rose sounds/01-Cracklin-rose.wav Soolaimon sounds/06-Soolaimon.wav Sweet
Caroline sounds/20-Sweet_Caroline.wav MacBook-Pro-6:TuteTasks mmitchel1s Once your
program is running upload a screenshot to the workspace. Below is a structure chart for this task:.
How do autopolyploidy and allopolyploidy differ Only autopolyploidy.pdfarihanthtextiles
How do autopolyploidy and allopolyploidy differ? Only autopolyploidy involves an increase in
chromosome sets. The chromosomes of an autopolyploid individual come from the same
species, while an allopolyploid has sets of chromosomes from different species. Autopolyploidy
is a mechanism of speciation in plants, while allopolyploid is a mechanism of speciation animals.
Autopolyploidy is sympatric, while allopolyploidy is allopatric.
Solution
Answer:
b). The chromosomes of an autopolyploid individual come from the same species, while an
allopolyploid has sets of chromsomes from different species
Autopolyploidy arises from fusion of gametes of the same species (cell division errors, etc.). In
this process, polyploid individuals develop as a result of cell division errors that double the DNA
content of gametes in individuals from the same species or a self-fertilizing individual. When
these double-dose gametes fuse, the result is an organism with double the chromosome number
of its parent species.
Allopolyploidy occurs when the gametes from two species fuse to form a polyploid generation
and hybrid offspring..
How do you find the order of growth for the following recurrenceT.pdfarihanthtextiles
How do you find the order of growth for the following recurrence?
T(n) = 9T(n/3) + n2
Solution
The Master Theorem applies to recurrences of the following form:
T (n) = aT (n/b) + f (n)
where a 1 and b > 1 are constants and f (n) is an asymptotically positive function.
There are 3 cases:
Case First:-- f(n) is O(nlogba ). Since the leaves grow faster than f, all work is done at the
leaves, so T(n) is (nlogb a).
Case Second:-- f(n) is (nlogba). The leaves grow at same rate as f, so the same order of work is
done at every level of tree. Therfore tree has O(log n) levels times the work done on one level,
yielding T(n) is (nlogb a log n).
Case Third:-- f(n) is (nlogba + ). Here f grows faster than the number of leaves, which means that
asymptotically the total amount of work is dominated by the work done at the root node. For the
upper bound, we also need an extra smoothness condition on f in this case i.e af(n/b) cf(n) for
some constant c < 1 and large n. In this case T(n) is (f(n)).
Therefore, using Master Method on your above Question
a=9, b=3, =log39 = 2, f(n) = n2, so Case 2, i.e. T(n) = (nlogn) = (n2logn)..
Explain SEAD, SAR and SPAAR routing protocols in more details.So.pdfarihanthtextiles
Explain SEAD, SAR and SPAAR routing protocols in more details.
Solution
SEAD Protocols: SEAD is a proactive secure routing protocol based on DSDV-SQ-protocol. It
does not rely on asymmetric encryption primitive but instead it relies on one-way hash chain for
security. The algorithm expects that there is some authenticated and secure way to deliver the
initial key KN. This could be done by key delivery in advance or by using public key encryption
and signatures for key delivery. The basic idea of SEAD is, to authenticate the sequence number
and metric of a routing table update message using hash chains elements. In addition, the
receiver also authenticates the sender ensuring that the routing information originates from the
correct node. The source of each routing update message in SEAD must also be authenticated
since an attacker may be able to create routing loops through the impersonation attack. There are
two different approaches proposed such as broadcast authentication mechanism, TESLA and
Message Authentication Codes
SAR routing protocols: SAR takes an approach to routing that incorporates security level of
nodes into traditional routing metrics. In most protocols the length of the route is the only metric
used. It does not target any protocol, but it rather provides security at a more generalized level of
security. The goal is exposing security to the application and to the routing protocol. SAR uses
AODV or DSR as a base protocol; it embeds the security metric into RREQ packet itself and
changes the forwarding behavior of the protocol. When intermediate nodes receive an RREQ
packet with a particular security metric or trust level, the node can only process the packet or
forward it if it can provide the required security or trust level.
SPAAR routing protocols: The SPAAR protocol was developed with the classical managed-
hostile environment in mind, thus meant to provide a very high level of security, and sometimes
at the cost of performance. Among other things, SPAAR also requires that each device to use a
GPS locator to determine its position, although some leeway is given to nodes using a so-called
“locator-proxy” if absolute security is not required. In SPAAR packets are only accepted
between neighboring nodes one hop away from each other, this is to avoid the “invisible node-
attack”. The basic transmission procedure is quite similar to ARAN, although the group
neighborhood key is used for encryption in order to ensure one-hop communication only. Since
all nodes also have information on their location they only forward RREQs if their position is
closer to the destination position.
Dynamic routing protocols are used toa) establish paths real ti.pdfarihanthtextiles
Dynamic routing protocols are used to:
a) establish path\'s real time between routers
b) define overhead bits within the packet
c) encapsulate the IP packet into a Layer 2 frame
d) reroute traffic during circuit failures and network congestion
e) a and b
f) a, c, and d
g) all of the above
Solution
a,c,d.
Evaluate expression without a calculator. Write answer in radians..pdfarihanthtextiles
Evaluate expression without a calculator. Write answer in radians.
Please show step by step so I can check my work. My answer -pi/6
Solution
sin^-1(-1/2) =y
range of sin^-1(x) : -pi/2<=y<=pi/2
So, value of y would be less than pi/2and its is -ve so it should be between -pi/2 and 0
y = sin^-1(-1/2)
siny = -1/2
y = -pi/6 radians.
Epithelial tissues that are only one cell thick are called _____ Epi.pdfarihanthtextiles
Epithelial tissues that are only one cell thick are called _____ Epithelial tissues that are more
than one cell thick are called _____ Of these two basic types of epithelial tissues, which is most
likely better at transport of substances? What structural aspect of this tissue makes it good at
doing this? What is the major function of the other basic type of epithelial tissue? What
structural aspect of this tissue makes It good at doing this? If the cells in an epithelial tissue are
wider than they are tall, they are called _____ cells. If the cells in an epithelial tissue are taller
than they are wide, they are called _____ cells. If the cells In an epithelial tissue are as wide as
they are tall, they are called _____ cells. Of these three types of cell shapes found In epithelial
tissues, which one is best at allowing for simple diffusion? What structural aspect of this tissue
makes it good at doing this? Of these three types of cell shapes found in epithelial tissues, which
ate best at allowing for active transport processes? What structural aspect of this tissue makes it
good at doing this? What type of cell-surface characteristic helps an epithelial tissue reduce
friction? What type of cell-surface characteristic helps an epithelial tissue in absorption and/or
secretion? What type of cell-surface characteristic helps an epithelial tissue allows it to move
particles across its surface?
Solution
- epithelium cells that are only one cell thick are known as simple epithelial tissues
- epithelium cells that are more than one cell thickness are known as stratified epithelial tissue
- simple epithelial tissue is good at transport of substances
- epithelial tissue consists of basement membrane on which it rests. this membrane acts as a
scaffold. through this membrane ther is nerve supply as this membrane is permeable hence it
allows the transport of substances
-the major function of stratified epithelial tisue is protection of the cells
-epithelial tissues acts as a lining surface to the body organs
-.
Describe in five sentences how the TLR system is used to fight HSV-1 .pdfarihanthtextiles
Describe in five sentences how the TLR system is used to fight HSV-1 encephalitis.
Solution
Toll like receptors are one type of PRRs, which are associate in the recognition of pathogen,
associated molecular patterns. These receptors are initially identified in Drosophila, they are also
found in macrophages, mast cells, dendritic cells in mammals. Toll-like receptors trigger the
production and release of cytokines and also activate other host defense responses associated
with innate and adaptive immune response. In response to HSV -1 (herpes simplex virus 1), the
TLR-2 releases cytokines that cause severe inflammatory response (innate immune response),
which leads to encephalitis. Antagonism of these receptors is likely to provide protection against
encephalitis caused by HSV-1. The TLR-2 are mainly located on the surface of microglia and
astrocytes..
Daunte is frustrated about managements recent decision to merge hi.pdfarihanthtextiles
Daunte is frustrated about management\'s recent decision to merge his two teams into one. He
discusses this issue with Claire, a so-worker. Claire responds by saying, \"Its sounds like
management\'s decision really bothers you.\" In the context of listening skills, Clarire\'s
statement best exemplifies a (n) sarcastic tone that blocks responses. (b) active response that
mirrors feelings (c) active response that advises the speaker. (d) blocking response that criticies
the speaker (e) negative response that magnifies the problem.
Solution
(b) active response that mirrors feelings.
Concern over the weather associated with El Nino has increased intere.pdfarihanthtextiles
Concern over the weather associated with El Nino has increased interest in the possibility that
the climate on earth is getting warmer. The most common theory relates an increase in
atmospheric levels of carbon dioxide (CO_2), a greenhouse gas, to increases in temperature. A
regression analysis of the mean annual CO_2 concentration (in parts per million) in the
atmosphere at the top of Mauna Loa in Hawaii and the mean annual air temperature (in degrees
Celsius) over both land and sea across the globe for 37 years was performed. Assume all
conditions are met for simple linear regression inference. A hypothesis test is to be performed to
determine if CO_2 levels is a significant predictor of air temperature. What is the correct
conclusion based on the results of the hypothesis test? Choose the correct answer below.
Solution
Here, the t statistic is
t = B1 / sB1
here, B1 = 0.004, sB1 = 0.009.
Thus,
t = 4.444444444
For a 0.001 level, the critical t value is, as df = n - 1 = 36,
tcrit= 3.582149701
Thus, as t > 3.5821, then it is OPTION D. [ANSWER].
Clostridium difficile is a bacteria currently making headlines. It h.pdfarihanthtextiles
Clostridium difficile is a bacteria currently making headlines. It has long been the considered the
most common health-care associated infection, causing death to a large number of patients when
they contract it during hospital stays. The CDC is now reporting an increase in C. difficile cases
even outside of hospitals, which is raising concern. Below is an electron micrograph of C.
difficile. If you were able to do a Gram stain on a sample of the bacteria, you would find that the
cells stain a dark purple.
Given this information, how would you classify C. difficile?
A.
Gram negative, rod shaped
B.
Gram positive, coccus shaped
C.
Gram negative, coccus shaped
D.
Gram positive, rod shaped
Many protists have evolved complex life cycles that include sexual reproduction. This means
that:
A.
haploid cells must undergo meiotic divisions to form gametes.
B.
complex mating behavior likely evolved at the same time as sexual reproduction.
C.
genetic material from two haploid cells is combined at some point in the life cycle.
D.
diploid cells must undergo mitotic cell division in order to reproduce.
Protists:
A.
are all eukaryotes.
B.
are all heterotrophs.
C.
are all photosynthetic.
D.
are all single-celled.
E.
All of the above are correct.
All of the following are examples of the evidence that supports the endosymbiotic theory
EXCEPT:
A.
Mitochondria and chloroplasts have their own genomes.
B.
Mitochondria and chloroplasts divide in a process resembling binary fission.
C.
Mitochondria and chloroplasts are similar in size to bacteria.
D.
Mitochondria and chloroplasts have linear chromosomes.
Solution
Clostridium difficle is a Gram positive, rod shaped bacteria.(option-D) Many protists have
evolved complex sexual reproductive life cycles which includes haploid cells undergo meiotic
division to form gametes. Protists are all eukaryotes, not an animal, plant or fungus. The point
\"mitochondria and chloroplaats have linear chromosomes\" is not an evidence that supports for
endosymbiotic theory..
You cloned an EcoRI digested DNA fragment into a unique EcoRI site o.pdfarihanthtextiles
You cloned an EcoRI digested DNA fragment into a unique EcoRI site of a vector. You identify
a recombinant vector that you believe has the DNA of interest. To generate a restriction map of
the recombinant plasmid, you take three individual samples of the plasmid and digest them with
EcoRI, HindIII, and with both EcoRI and HindIII. You then run the digested DNA on an
agarose
gel to see the fragments. The gel is then subjected to a Southern hybridization using the EcoRI
insert as a probe. Assume that the insert fragment is smaller than the vector.
15. Which fragment (s) on the gel would hybridize to the probe which represents the inert?
16. Which fragment (s) on the gel would hybridize to a probe representing the 5.3 kb band
observed in the EcoRI lane?
17. Which fragment (s) in the EcoRI lane would hybridize to a probe representing the 4.1 kb
band observed in the HindIII lane?
18. The cloning strategy used being non-directional, the recombinant plasmid may represent one
of two possible orientations of the insert. You perform a hybridization with the 1.5 kb band
observed in the EcoRI lane. Which fragment (s) would not be observed in the opposite
orientation of that represented on the gel?
PLEASE EXPLAIN THOUGHT PROCESS 5.3 4.1 2.7 1.5 EcoRI HindIII EcoRI Hind 3.0 2.3
1.1 0.4
Solution
The band of HINDIII (2.7) and the band of EcoRI+HINDIII (2.3) represent the fragments that
will hybridize to 5.3kb band probe.
The band of EcoRI+HINDIII (3.0) and the band of EcoRI (1.5) represent the fragments that will
hybridize to 4.1kb band probe.
The fragments which will mot be observed in opposite direction are the ones which are dual
enzyme digested. The reason behind this is that when dual enzyme digestion occurs it causes an
incompatible recognition sequence in the opposite direction. Therefore such fragments are found
in the middle of two individual enzyme digestions..
You have constructed a new reporter gene to help you find novel zebr.pdfarihanthtextiles
You have constructed a new reporter gene to help you find novel zebrafish mutations. The
reporter gene consists of several LEG/TCF binding domains in the enhancer fused to the coding
region for green fluorescent protein (GFP). Wild-type embryos that contain this transgene
normally express it in the brain and eye primordia and have no developmental defects. You then
mutagenize this reporter strain to look for new mutants that affect GFP expression.
Which developmental pathway are these mutants likely to be in and why?
You find a mutant (which you call GLO-1) that ubiquitously expresses your reporter gene
throughout the entire embryo. Which molecule in the above pathway is most likely to be mutated
and why?
Solution
Ans.) Nacre, a zebrafish homolog of MITF is required for pigment cell differentiation. We
isolated a promoter region of shell that contains Tcf/Lef binding sites which will mediate Wnt
responsiveness. This promoter binds to zebrafish Lef1 protein in vitro, and a nacre
communicator construct is powerfully inhibited by dominant-negative Tcf in malignant
melanoma cells. Mutation of Tcf/Lef sites abolishes Lef1 binding and reporter operates in vivo.
Wnt signaling so directly activates shell, which in flip ends up in pigment cell differentiation.
It was determined that the human melanocyte-specific MITF promoter contains many purported
Tcf/Lef binding sites, hallmarks of Wnt/-catenin-mediated transcriptional control. To test the
hypothesis that nacre could be a target of the Wnt/-catenin pathway in zebrafish, a
promoter/enhancer region is isolated for this sequence from a genomic bacteriophage library.
This genomic fragment contains the translation initiation site for nacre which is associated with a
836-bp upstream region with a possible transcription begin site, a cAMP response element
(CRE) and several agreement Tcf/Lef binding sites. These CRE and Tcf/Lef locations are not
fully preserved between the human and zebrafish promoters in either their sequences or their
positions from the transcription begin site. To examine whether the purported putative nacre
promoter/enhancer will direct correct abstraction management of organic phenomenon, injected
one -cell zebrafish embryos with the 836-bp deoxyribonucleic acid fragment driving a green
fluorescent macromolecule (GFP) communicator sequence. Mosaic gene expression is typical for
transient transgenics in zebrafish and because the neural crest springs from only a few precursor
cells, reporter potency is minimized. Despite these, it was ready to analyze the fate of the few
reporter-expressing cells in injected animals..
Write a Java program that will incorporate either a sequential searc.pdfarihanthtextiles
Write a Java program that will incorporate either a sequential search method or a sort method
Solution
class Search
{
public static void main(String args[])
{ int array[],n;
System.out.println(\"Please enter the sixe of array\");
Scanner s = new Scanner(System.in);
int n = s.nextInt();
System.out.println(\"Please enter\"+ n +\"elements of array\");
for(int i= 0;i.
Answer only with excel instructions.Assume that 96 of ticket hold.pdfarihanthtextiles
Answer only with excel instructions.
Assume that 96% of ticket holders show up for an airline flight. If a plane seats 200 people, how
many tickets should be sold to make the chance of an overbooked flight (more ticket holders
show up for a flight than there are seats available) is at most 10%.
Solution
Say no. of tickets booked = x
Now only 0.96x will turn up
No. of seats = 200
Now these 0.96x people should get a seat with 90% probability
200 / (0.96x) >=0.9
200/0.864 >= x
x <=231.48
x = 231
Airline will make 231 reservations.
A new species of sea horse has been discovered and is being sequenced.pdfarihanthtextiles
A new species of sea horse has been discovered and is being sequenced The genome of the new
species is being aligned using the reference sequence from a already-known species of sea horse
Since the two species are evolutionary diverged, there may be some differences between their
sequences Reference sequence: ACCTACATTCACAGAATGAT Fragments a) Align the set
of mini-fragments above. b) How are the sequences of the two sea horse species different? c)
Would this alignment have been easier or more difficult if you didn\'t have any reference
sequence at all (alignment without a reference is called \"de novo\")? Explain d) If there had
been sequencing errors, would this alignment have been easier or more difficult? Explain.
Solution
A) TAGATT TGAATG TCACTGA
B) There is a form of polymorphism occurring in the new sequence of the genes for the new
species of sea horses. There is single nucleotide polymorphism in the new species as C is
replaced by T and A instead of G which may probably occurred due to some sort of mutation
during genetic sequencing.
C) The given alignment would be difficult without reference DNA sequence as reference
sequence gives basic DNA information and a reference database techniques is much easier than
performing a de novo technique though de novo methods are well established using mass spectra
nowadays but still having a reference database helps and gives the better coding information of
protein sequence.
D) if there had been a sequence error there would be difficulty in alignment and in that case we
have to perform de novo sequencing using mass spectra analysis. To know the sequence of the
species and other information regarding the DNA characters..
Which of the following is the mechanism of action for Herceptin Her.pdfarihanthtextiles
Which of the following is the mechanism of action for Herceptin? Herceptin binds to the HER2
promoter to prevent transcription, thus lowering amounts of receptor. Herceptin binds to
intracellular HER2 proteins to prevent cancer cells from dividing. Herceptin binds to HER3 and
HER4 cell surface receptors to activate the immune system. Herceptin binds to extracellular
domain of HER2 and prevents internalization and subsequent cancer cell division. Herceptin
targets TNF alpha.
Solution
B) herceptin binds to intracellular ER2 proteins to prevent cancer cells from dividing
Trastuzumab (herceptin) activates p27 factor by inhibiting PI3K/Akt, Mirk and hKIS pathways.
HER2 protein can be expressed up to 100 times more in cancer cells. PI3K/Akt, Mirk and hKIS
are intracellular proteins in HER2 pathways are activated which promote cell proliferation.
Signals present in these pathways promote growth of blood vessels in order to supplement for
tumour formation or angiogenesis and therefore resulting in cell proliferation. Thus, when
herceptin inhibits PI3K/Akt, Mirk and hKIS pathways, the cell proliferation is inhibited..
Which of these statements best describes an element An element is c.pdfarihanthtextiles
Which of these statements best describes an element? An element is composed of three
subatomic particles. An element is formed when two atoms of the same kind are bonded
together. An element is formed when two or more different atoms combine chemically. An
element is composed of identical atoms.
Solution
An element is composed of identical atoms.
Molecules can be made of elements, but elements arent made from molecules. 2 or more atoms
of the same kind make up an element.For example H is hydrogen which is an element formed
from H atoms only whereas H2O is a compount formed from 2 different atoms H and O..
What is the general goal for descriptive statistics How is the goal.pdfarihanthtextiles
What is the general goal for descriptive statistics? How is the goal served by putting scores in a
frequency distribution? How is the goal served by computing a measure of central tendency?
How is the goal served by computing a measure of variability?
Solution
What is the general goal of descriptive statistics ?
Answer : To simplify , organize, and summarize data so that it is easier for researchers to see
patterns.
How is the goal served by putting scores in a frequency distribution?
A frequncy distribution provides an organized summary of the complete set of scores.
How is the goal served by computing a measure of central tendency?
Summarizes an entires set of scores with a single value that is representative of the whole set.
How is the goal served by computing a measure of variability?
Provides a single number that describes the differences that exist from complete score to another..
What effects are shown on this graph (assume that all effects where.pdfarihanthtextiles
What effects are shown on this graph? (assume that all effects where the marginal means differ
are significant)
Choose as many as applicable.
A. Main effect of A where scores are higher at A1 than A2
B. Main effect of A where scores are higher at A2 than A1
C, Main effect of B where scores are higher at B1 than B2
D, Main effect of B where scores are higher at B2 than B1
E. Interaction where the effect of A is larger at B1 than B2
F. Interaction where the effect of A is larger at B2 than B1
Solution.
What are adaptive peaks How do organisms move from one adaptive pea.pdfarihanthtextiles
What are adaptive peaks? How do organisms move from one adaptive peak to another? 100
words or more please
Solution
An equilibrium state in a population when the gene pool has allele frequencies that maximize the
average fitness of a population\'s members. In other words, A high point (perhaps one of several)
on an adaptive landscape; selection tends to drive the genotype composition of the population
toward a combination corresponding to an adaptive peak.
Most extant organisms are thought to sit on the “peaks” of such adaptive landscapes. However,
how does a phenotype shift from one peak to another is not clear. Common hypotheses include
(1) There are “ridges” connecting the adaptive peaks, such that phenotypes along the ridge are
more or less equally fit under a specific environment;
(2) There are no ridges connecting the peaks but when effective population size is small enough,
phenotypes may be able to traverse the less-adaptive region (i.e. adaptive valley) by genetic drift..
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
I need help writing the methods for the song and playList class in J.pdf
1. I need help writing the methods for the song and playList class in Java. I already have the
interface and the getters and setter. Can someone help with the methods?
Song Class
public class Song
private String artist // the artist performing the song
private String title // the title of the song
private int minutes // number of min in length
private int seconds // number of seconds of length of the song (always less than 60)
// Add Getters / Setters for all fields
// Three constructors (remember to initialize ALL fields in each of the constructors - regardless
of the number of parameters!)
public Song(String artist, String title)
public Song(String artist, String title, int minutes, int seconds)
public Song(Song s)
public boolean equals(Object o) // a song is equal if all four fields are equal
public String toString() { // Use this code for toString EXACTLY
return "{Song: title = " + title + " artist = " + artist + "}";
}
public void play() { // Use this code for play EXACTLY
System.out.printf("Playing Song: artist = %-20s title = %s ", artist, title);
}
Make the Song class implement the interface Comparable, and make the ordering criteria as
follows: Songs will be ordered by artist in ascending order. If the artists are the same, then by
title in ascending order. If both artist and title are the same, then any order is acceptable.
Don’t forget to include any methods needed to implement the Playable interface.
PlayList Class
public class PlayList
Methods that modify the list should return a boolean return true if they successfully change the
list, otherwise they return false. Note that a PlayList can contain other PlayLists!
Methods that return a Playable element return null if they fail to find the song in question.
private String name // contains the name of the playlist
private ArrayList playableList // ArrayList of Playable elements that make up the play list
// Add Getters / Setters for name and songList
// Add a toString() method that returns the name of the playlist followed by its contents (by
calling toString() on each item it contains). You should only have one name/title per line
2. // Two constructors (remember to initialize ALL fields in each of the constructors - regardless of
the number of parameters!)
public PlayList() // empty play list named "Untitled"
public PlayList(String newName) // empty play list
public boolean loadSongs(String fileName) // loads songs from file, more on this below
public boolean clear() // removes all playable elements in the play list
public boolean addSong(Song s) // adds Song s to the end of the play list
public Playable removePlayable(int index) // removes Playable element at index from the list and
returns it
public Playable removePlayable(Playable p) // removes every occurrence of Playable p from the
list and returns p
public Playable getPlayable(int index) // returns the Playable element at the appropriate index
public boolean addPlayList(PlayList pl) //adds the PlayList that is being passed to the end of the
playableList and returns true unless the playableList already contains a playlist with the same
name, in this case do not add the playlist and return false. Playlists are uniquely identified by
name, so your program should not allow there to be two playlists with the same name.
public void play() // plays the play list by calling play() on each item in the play list in order
public int size() // returns the number of songs in the play list and all songs contained in any of
the nested play lists. For example if p1 is a playlist that contains songs s1, s2 and s3 as well as
play list p2. Also, suppose that p2 contains songs s4, s5, s6, and s7, then if I called size on p1 it
should return 7.
Write a method in PlayList called sortByName(). This method will sort the Playable items by the
value returned by getName() in ascending order.
You must use a comparator object with Collections.sort() to achieve this. The interface to
implement is Comparator.
Also add a method sortByTime() in PlayList that sorts by the Song or PlayList's total time in
seconds, in ascending order (shortest first). It also must use a comparator object to achieve this.
That object will use one of the methods in the Playable interface to get the time for each object.
Solution
Song class
public class Song implements Comparable {
private String artist; // the artist performing the song
private String title; // the title of the song
3. private int minutes; // number of min in length
private int seconds; // number of seconds of length of the song (always less than 60)
public Song(String artist, String title)
{
this.artist=artist;
this.title=title;
}
public Song(String artist, String title, int minutes, int seconds)
{
this.artist=artist;
this.title=title;
this.minutes=minutes;
this.seconds=seconds;
}
public Song(Song s)
{
this(s.artist, s.title, s.minutes, s.seconds);
}
public boolean equals(Object o) // a song is equal if all four fields are equal
{
Song s=(Song)o;
if(this.artist.equals(s.artist)&&this.title.equals(s.title)&&this.minutes==s.minutes&&this.seconds
==s.seconds)
return true;
return false;
}
public String toString() { // Use this code for toString EXACTLY
return "{Song: title = " + title + " artist = " + artist + "}";
}
public void play() { // Use this code for play EXACTLY
System.out.printf("Playing Song: artist = %-20s title = %s ", artist, title);
}
public String getArtist() {
4. return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getMinutes() {
return minutes;
}
public void setMinutes(int minutes) {
this.minutes = minutes;
}
public int getSeconds() {
return seconds;
}
public void setSeconds(int seconds) {
this.seconds = seconds;
}
@Override
public int compareTo(Song arg0) {
int a=artist.compareTo(arg0.artist);
if(a==0)
{
a=title.compareTo(arg0.title);
}
return a;
}
}
PlayList class
import java.io.FileNotFoundException;
import java.io.FileReader;
5. import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
public class PlayList {
private String name; // contains the name of the playlist
private ArrayList playableList; // ArrayList of Playable elements that make up the play list
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList getPlayableList() {
return playableList;
}
public void setPlayableList(ArrayList playableList) {
this.playableList = playableList;
}
public PlayList()
{
name="";
playableList=new ArrayList();
}
public PlayList(String newName)
{
name=newName;
playableList=new ArrayList();
}
public boolean loadSongs(String fileName) throws FileNotFoundException
{
FileReader fr = new FileReader(fileName);
Scanner sc = new Scanner(fr);
while(sc.hasNextLine())
{
String data = sc.nextLine();
6. String[] value = data.split(",");
Song s = new Song(value[0], value[1],
Integer.valueOf(value[2]),Integer.valueOf(value[3]));
addSong(s);
}
return true;
}
public boolean clear() // removes all playable elements in the play list
{
playableList.clear();
if(playableList.isEmpty())
return true;
return false;
}
public boolean addSong(Song s) // adds Song s to the end of the play list
{
playableList.add(s);
return false;
}
public Song removePlayable(int index) // removes Playable element at index from the list and
returns it{
{
Song s=(Song) playableList.remove(index);
return s;
}
public Song removePlayable(Song p) // removes every occurrence of Playable p from the list
and returns p
{
playableList.remove(p);
return p;
}
public Song getPlayable(int index) // returns the Playable element at the appropriate index
{
Song s=playableList.get(index);
7. return s;
}
public boolean addPlayList(PlayList pl) //adds the PlayList that is being passed to the end of
the playableList and returns true unless the playableList already contains a playlist with the same
name, in this case do not add the playlist and return false. Playlists are uniquely identified by
name, so your program should not allow there to be two playlists with the same name.
{
playableList.addAll(pl.getPlayableList());
return false;
}
public void play() // plays the play list by calling play() on each item in the play list in order
{
Iterator< Song> ir=playableList.iterator();
while(ir.hasNext())
{
ir.next().play();
}
}
public int size() // returns the number of songs in the play list and all songs contained in any of
the nested play lists. For example if p1 is a playlist that contains songs s1, s2 and s3 as well as
play list p2. Also, suppose that p2 contains songs s4, s5, s6, and s7, then if I called size on p1 it
should return 7.
{
playableList.size();
return 0;
}
void sortByTime()
{
Collections.sort(playableList, new SortByTime());
}
void sortByArtistName()
{
Collections.sort(playableList, new Sortbyname());
}
8. @Override
public String toString() {
return "PlayList [name=" + name + ", playableList=" + playableList + "]";
}
}
SortByName class
import java.util.Comparator;
/**
* implement comparator to sort volume by name
*/
public class Sortbyname implements Comparator {
@Override
public int compare(Song o1, Song o2) {
return o1.getArtist().compareTo(o2.getArtist());
}
}
SortByTime class
import java.util.Comparator;
public class SortByTime implements Comparator {
@Override
public int compare(Song arg0, Song arg1) {
if(arg0.getMinutes()>arg1.getMinutes())
return 1;
else if(arg0.getMinutes()arg1.getSeconds())
return 1;
else if(arg0.getSeconds()