bers to the screen AND to an output file. Instructions For this assignment, imagine you are burning some music CDs for a party. You have arranged a list of songs in the order you want to play them. However, you would like to maximize your use of space on the CD, which holds 80 minutes of music. To do so, you want to figure out the total time for a group of songs and see how well they fit. Write and design a C++ program to help you accomplish this task. The number of seconds for each song is already provided for you below: 310
Overview
You will read data from a text file using a control loop, convert the numbers to the proper format, and then send the numbers to the screen AND to an output file.
Instructions
For this assignment, imagine you are burning some music CDs for a party. You have arranged a list of songs in the order you want to play them. However, you would like to maximize your use of space on the CD, which holds 80 minutes of music. To do so, you want to figure out the total time for a group of songs and see how well they fit. Write and design a C++ program to help you accomplish this task. The number of seconds for each song is already provided for you below:
310
462
627
273
300
535
259
625
736
122
215
Save this table in a separate data file and name it “songs.txt” Save it in the same folder as your program file. The time is entered as seconds. For example, if a song takes 7 minutes and 42 seconds to play, the data entered for that song would be 462.
Create a program that
- Reads the data from the song.txt file
- Calculates the minutes & seconds for each song.
- Prints the list of songs, the amount of time it consumes, the total amount of time on the CD, and the amount of time remaining available on the CD.
- Prints the output in the form of a table with columns and headings written on a file. For example:
Note: The output converts the input from seconds to minutes and seconds. Use meaningful variable names, proper indentation, and appropriate comments. Thoroughly test the program using your own data sets.
- Make the program aesthetically appealing for the user and for a fellow programmer
Use meaningful variable names, proper indentation, and appropriate comments. Thoroughly test the program using the data set found in songs.txt file provided for you.
Template
//<File name> -- brief statement as to the file’s purpose
//CSIS 111-<Section Number> ADD YOUR SECTION NUMBER
//<Sources if necessary>
//Include statements #include <iostream> #include <string> using namespace std;
//Global declarations: Constants and type definitions only -- no variables
//Function prototypes int main()
{
//In cout statement below SUBSTITUTE your name and lab number
cout << "Your name -- Lab Number" << endl << endl;
//Variable declarations
//Program logic
//Closing program statements system("pause");
return 0;
}
//Function definitions
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images