Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Please write clear code so i could understand it. 11 function about >>1. Default Constructor ,2.Overloaded constructor, 3.GetSongName,4. SetSongName, 5.GetAlbumName, 6.SetAlbumName, 7.GetArtistName,8. SetArtistName, 9.GetTrackNumber,10.

C++ Please write clear code so i could understand it. 11 function about >>1. Default Constructor ,2.Overloaded constructor,

3.GetSongName,4. SetSongName,

5.GetAlbumName, 6.SetAlbumName,

7.GetArtistName,8. SetArtistName,

9.GetTrackNumber,10. SetTrackNumber,

11.Song::printc {

cout<

cout<

cout<< ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cout<<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EX. Song YMCA ( "YMCA" , "SONALPL" , "The VILLAGBPE" , "1" , YMCA.printc );

Music organization software like iTunes provides users with a variety of ways to display music. You will implement MyTunes, which will allow users a small section of normal music management options:

Ability to enter a new song

Ability to sort songs by album, then by track number

Ability to search for albums

In order to more easily store user input data, you will create a Song class by creating a header file and implementation file. The class should have four (private) data members:

Song name

Album name Artist name

Track number

The class should have getter and setter functions for each data member. Further, there should be two constructors. One constructor has no parameters and should set each data member to a default value of your choice. Another constructor should have four parameters (one for each data member) setting the four private members. Finally, there should be a print function, which does the following tasks.

prints an end-of-line character

prints the song name, left-aligned, among 22 spaces

prints the album name, left-aligned, among 22 spaces

prints the artist name, left-aligned, among 22 spaces

prints the track number, right-aligned, among 4 spaces You will then create a client file named MyTunes.cpp to implement the functionality described in the introduction. Here are details about the client code.

General I/O Comments o For input, use cin and when necessary, getline o For output, use cout

Main functionality is menu driven, specified below

o User interaction is guided via a menu, looping until the user enters 0 (see below).

o Entry 1 will be for adding a new song o Entry 2 will be for sorting the song list

o Entry 3 will be for searching the song list o Entry 4 will be for printing the song list

o Entry 0 will be for exiting the loop

o For any other entry, inform the user of the error and allow them to re-enter

Use cin to obtain the user entry o After the user enters the choice, call cin.ignore();

Implement menu interaction using at least one client function

Adding a new song

o ask the user for song name, album name, artist name, and track number

o enter data into a Song object and place at end of the array if space is available

o inform the user if the addition was successful or if it failed

o implement these requirements using one or more client functions

Sorting the song list

o You may assume that all album names are entered and stored in all upper-case letters

o The array of songs should be sorted in alphabetical order by album name

o For each album, the songs should also be sorted by track number in ascending order

o Once sorted, call the print function specified below

o implement these requirements using one or more client functions

Searching for an album

o Ask the user the name to search for (entries can be assumed to use upper-case letters)

o Ensure that the array is in sorted order

o Use binary search to locate the requested album

o If not found, inform user

o If found, list all songs in the album (Use print() from the Song class for each one)

o implement these requirements using one or more client functions

Printing the songs

o Print each song in the list. Each Song instance should call its class Print function

o Implement this requirement using a client function

o Optional: in my example outputs, notice that I have a formatted heading for the printed list. This is not a requirement, but it looks a little nicer and explicitly categorizes each column

Some of this project will challenge your logical and critical thinking skills. It is recommended you think of the design (structure, flow, logic sequence) of the program before implementing it. Do not rush into coding this all at once. You will highly benefit from the following approach:

Write down, on paper, how the overall design of the program should look. You dont need to have it 100% correct in your head at first, but getting your thoughts down on paper will help you organize/refine your approach and foresee potential obstacles.

Get into the habit of implementing function stubs (review this topic if you need a refresher) and building incrementally. Give your program empty/basic functionality at first and then add and test one piece at a time. This will allow you to verify each piece as you go, and will help you robustly build from the ground up, rather than trying to throw together all the code at once and debugging the resulting nightmare. The first strategy will cause much less time and agony in the long run. Building your program slowly from the ground up will also allow you to foresee potential problems later on in development and prevent them early on.

Test many different input cases as you are developing your program and even once you feel that the program is complete. A good strategy is to try to break your program with a variety of different test casesit is much better for you to find a software mistake and fix it early than to have the final product fail the end user(s) because you didnt test adequately.

Testing: The three files you should be implementing are MyTunes.cpp, Song.cpp, and Song.h. Make sure that the file names are correct. I have included a set of test input files (and the resulting output from my version of the program) on Canvas for you to use. Test file: in_sort.txt, in_search.tx, in_all.txt, Output should look like...: out_sort.txt t out_search.txt out_all.txt Submission: This project is worth 125 points and is due on Wednesday, March 4th before class.

Submission must include:

An electronic turn-in through Canvas. The entire Visual Studio solution folder must be zipped in order to do this. To create a zipped folder, right-click the folder and select Send to -> Compressed (zipped) folder. Rename this folder Project3_firstname_lastname where firstname and lastname are replaced with your first and last name, respectively. Upload this zipped folder to the Project 2 assignment page.

A paper printout of your code, along with console outputs using inputs from each of the 3 test input files above.

Grading: The program will be graded along the following dimensions. Note that the values in brackets are percentages of the project grade. Point distributions will be weighted accordingly.

[20] Song class implemented correctly

[15] Song header file written correctly

[10] Menu interaction works correctly

[20] Sorting works correctly

[20] Searching works correctly

[20] Adding new song works correctly

[20] Overall quality of the code design/structure and program interaction

For the final bullet, ensure that the program files contain header comments, formatted as required by the CSCI documentation guidelines. Each function should have a description of its purpose and what it accomplishes. Documentation (commenting) is used to illustrate major sections or unclear sections of code as well. Program design should clearly convey intent, especially focusing on proper use of variable names, whitespace, alignment and indentation

Make sure that your program contains no syntax errors and that all of the code compiles. Programs that do not compile will receive an automatic 25 point deduction (20% of the project grade). This will be in addition to any deductions on the items listed above. If you are unable to decipher a compiler error in your program, its better to comment out that section of code so that the program compiles without error. This way I can see that it was at least attempted and you may receive partial points for that section of code. In addition to the commented out section, write a detailed explanation of what you think the error may be, and the steps you tried in order to fix the error.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

=+a) What are the null and alternative hypotheses?

Answered: 1 week ago