CS300Fall19_Assignment1 CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 1 Implement a play list for a radio station as a collection of songs stored in a linked list. The radio...

1 answer below »
I have provided the convention writing file as well


CS300Fall19_Assignment1 CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 1 Implement a play list for a radio station as a collection of songs stored in a linked list. The radio station can add songs to the front of the list. The radio station can play the song at the end of the play list and then remove that song from the playlist. The application needs to provide the following functionalities: • Add song to the play list • Remove song from the play list • Play next song in the play list • List all songs in the play list • Display total duration for the play list Sample run is provided below: Welcome to CS@BC Radio Station (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: a Enter title: Stories from Emona I Enter artist: Maya Filipic Enter duration: 200 ………………………………………….. Song is added to the play list. ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: a Enter title: River Flows in You Enter artist: Yiruma Enter duration: 180 ………………………………………….. Song is added to the play list. ………………………………………….. (a) Add song CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 2 (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: a Enter title: When Dreams Come True Enter artist: Gypsy Flamenco Masters Enter duration: 160 ………………………………………….. Song is added to the play list. ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: b Enter title: When Dreams Come True Enter artist: Gypsy Flamenco Masters ………………………………………….. Song is deleted. ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: c Enter title: When Dreams Come True ………………………………………….. Song is not found ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: d ………………………………………….. CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 3 Playing “Stories from Emona I” by Maya Filipic (200 seconds…) ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: e ………………………………………….. 1 song(s). Title: River Flows in You Artist: Yiruma Duration: 180 ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: f ………………………………………….. Total number of songs: 1 Total time: 180 seconds ………………………………………….. (a) Add song (b) Delete song (c) Search for a song (d) Play next song (e) List all songs in playlist (f) List total time of playlist (q) Quit Choose an operation: q ………………………………………….. Thanks for using the application! CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 4 Write a C++ program to implement the play list app so that your program works as shown above. C++ concepts required in the assignment: • Templates • Friend functions • Reference parameters • Pointers • Operator overloading HOW TO SUBMIT You are supposed to submit your work as a single zip file via CANVAS. Zip file will include all source codes including .h and .cpp files. Please use the following file format while naming the zip file: LastNameFirstnameX_Y.zip where LastNameFirstname is your last name with the first letter in capital, followed by your first name with the first letter in capital; the X is the course code; the Y is the assignment #. (ex: SerceFatmaCS300_1.zip) HOW TO EVALUATE: The following rubric describes how your work will be evaluated. Correctness (90 points) • [90] Program is correct in object oriented design and function; meets specification; and utilizes heap memory well • [75] Program output is correct but elements of specification missing, e.g. variable/method declarations. • [45] Part of the specification has been implemented, e.g. one out of two required • subprograms. • [20] Program has elements of correct code but does not assemble/compile. Readability (20 points) • [10] Programmer name and assignment present. Sufficient comments to illustrate program logic. Well-chosen identifiers. • [7] Programmer name present, most sections have comments. Fair choice of identifiers • [5] Few comments, non-meaningful identifiers • [0] No programmer name. No comments. Poor identifiers CS300Fall19_CodingConventionCPlusPlus CS 300 Data Structure – Fall 2019 C++ Naming Conventions and Documentation 1. Class Names: Name the class after what it is. If you can’t think of what it is that is a clue you have not thought through the design well enough. a. Use upper case letters as word separators, lower case for the rest of a word b. First character in a name must be upper case c. No underscores (_) are permitted Example: class Point class PhonebookManager 2. Function Names: Every function performs an action, so the name should make clear what it does so each method/function should begin with a verb. a. First character in a name must be lower case b. Prefixes are sometimes useful: i. is/has ii. get – to get a value iii. set – to set a value Example: checkForErrors(); //instead of errorCheck() saveFile(); isEmpty(); getName(); 3. Pointer Variables: Pointers should be prepended by a ’p’ in most cases. Place the * close to the variable name rather than the pointer type Example: string *pName= new string; string *pName, name, address; // note, only pName is a pointer 4. Method Argument Names: The first character should be lower case. All word beginnings after the first letter should be upper case as with class names. Example: class Test{ public: int area(Point& rSomePoint, Point anotherPoint); } 5. Global Constants: Global constants should be all caps with ’_’ separators. Example: const double TWO_PI = 6.28318531; 6. Static Variables: Static variables should be prepended with ’s’. Example: private: static StatusInfo sStatus; 7. White Spaces a. Conventional operators should be surrounded by a space character. a = (b + c) * d; // NOT: a=(b+c)*d b. Functions should be separated by one blank line. int getCount(){ } void print(){ } 8. Comments a. Use descriptive names for class, function and variable names. It would be good to have a self- documenting code. b. Give a Header Comment, at the top of the program including the author, date and a short description of the file c. Give a comment before each public function definition d. Give comments for the members that need clarification e. All comments should be written in English Example: // Name : Example.cpp // Author : Fatma C Serce // Date : 10/14/2017 // Description : Prints hello, calculates class average and display it Class Example{ public: void print(); } //prints Hello World to the standard output void HelloWorld::print(){ cout<”hello class!”;="" this="" calculates="" the="" class="" average="" for(int="" i="0" ;=""><>
Answered Same DayNov 06, 2021

Answer To: CS300Fall19_Assignment1 CS 300 Data Structures – Fall19 Assignment-1 Due Date: October 11, 2019 1...

Neha answered on Nov 09 2021
156 Votes
Playlist-LinkedList/client.cpp
#include
#include
#include
#include "RadioStation.h"
#include "LinkedList.h"
#include "Node.h"
using namespace std;
int getTrack()
{
bool inputCheck;
int trackNumber;
do
{
inputCheck = true;
cout << "Please enter the track number you'd like to view: ";
if (!(cin >> trackNumber))
{
cout << "Please enter numbers only.\n";
cin.clear();
cin.ignore(
10000,'\n');
inputCheck = false;
}
} while (!inputCheck);
return trackNumber;
}
int main()
{
LinkedList songs;
char goAgain = 'y';
int trackNumber;
string trackName;
// Insert some songs into our list
songs.insert(1, "One More Saturday Night");
songs.insert(1, "Friday I'm in Love");
songs.insert(3, "Sunday Morning Coming Down");
songs.insert(1, "California Love");
cout << "Welcome! There are " << songs.getLength() << " tracks.\n";
while (goAgain!='n')
{
trackNumber = getTrack();
try
{
trackName = songs.getEntry(trackNumber);
}
catch (invalid_argument arg)
{
cout << arg.what() << endl;
trackName = "No Track";
}
cout << "Your track name is " << trackName << endl;
cout << "Go again? (y/n) ";
cin >> goAgain;
}
cout << endl << "**Debugging** Now using setEntry to change song #1 to Boiled Frogs." << endl;
songs.setEntry(1, "Boiled Frogs");
cout << "Playlist now has " << songs.getLength() << " tracks in this order: " << endl;
for (int i = 0; i cout << "Track #" << i+1 << ": " << songs.getEntry(i+1) << endl;
}
cout << endl;
cout << "**Debugging** Now using remove to delete track #3." << endl;
songs.remove(3);
cout << "Playlist now has " << songs.getLength() << " tracks in this order: " << endl;
for (int i = 0; i cout << "Track #" << i+1 << ": " << songs.getEntry(i+1) << endl;
}
cout << endl;
cout << "**Debugging** Now using insert function to extend list." << endl;
cout << "Adding song: Phoenix in Flight" << endl;
songs.insert(1, "Phoenix In Flight");
cout << "Adding song: Waiting Room" << endl;
songs.insert(1, "Waiting Room");
cout << "Adding song: Holland, 1945" << endl;
songs.insert(1, "Holland, 1945");
cout << endl;
cout << "Playlist now has " << songs.getLength() << " tracks in this order: " << endl;
for (int i = 0; i cout << "Track #" << i+1 << ": " << songs.getEntry(i+1) << endl;
}
cout << endl;
cout << "**Debugging** Now using reverse function to reverse all songs." << endl;
songs.reverse();
cout << "Playlist now has " << songs.getLength() << " tracks in this order: " << endl;
for (int i = 0; i cout << "Track #" << i+1 << ": " << songs.getEntry(i+1) << endl;
}
cout << endl;
cout << "Rock on!\n";
return 0;
}
Playlist-LinkedList/LinkedList.cpp
#include "LinkedList.h" // Header file
#include
#include
#include
#include
template
LinkedList::LinkedList() : headPtr(nullptr), tailPtr(nullptr), itemCount(0)
{
headPtr = nullptr;
tailPtr = nullptr;
itemCount = 0;
} // end default constructor
template
LinkedList::LinkedList(const LinkedList& aList) : itemCount(aList.itemCount)
{
Node* origChainPtr = aList.headPtr;
if (origChainPtr == nullptr)
{
headPtr = nullptr;
tailPtr = nullptr;
}
else
{
// Copy first node
headPtr = new Node();
headPtr->setItem(origChainPtr->getItem());

// Copy remaining nodes
Node* newChainPtr = headPtr;
origChainPtr = origChainPtr->getNext();
while (origChainPtr != nullptr)
{
// Get next item from original chain
ItemType nextItem = origChainPtr->getItem();

// Create a new node containing the next item
Node* newNodePtr = new Node(nextItem);

// Link new node to end of new chain
newChainPtr->setNext(newNodePtr);

// Advance pointer to new last node
newChainPtr = newChainPtr->getNext();

// Advance original-chain pointer
origChainPtr = origChainPtr->getNext();
} // end while

newChainPtr->setNext(nullptr); // Flag end of chain
} // end if
} // end copy constructor
template
LinkedList::~LinkedList()
{
clear();
} // end destructor
template
bool LinkedList::isEmpty() const
{
return itemCount == 0;
} ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here