Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program Overview Write a C+ console application to track song data. The program will use structs, arrays, and functions. The program should display a menu
Program Overview Write a C+ console application to track song data. The program will use structs, arrays, and functions. The program should display a menu and take action depending on what the user enters. Details of the menu and actions to take for each selection are given below. You will need to create the input data files. A description of the file formats and sample data is given at the end of the assignment. Make sure you split up the code into header files (.h) and source files (.cpp). All structs should be stored in one header file (.h). All function prototypes should be in another header file (.h) All function definitions should be in one source file (.cpp). The main function should be in yet another source file (.cpp) structs Below is the list of structs that you need to create for your program. Be aware that the Song struct has members of type Artist and Time (the other structs you wrote). Ctt struct Members Artist Name (string) CountryOfOrigin (string) Time Minutes (int) Seconds (int) Title (string) Artist (Artist) Length (Time) Song Here are the functions to create C++ Function Name Purpose LoadSongDataFromFile Loads song data from a user specified file. This function should first prompt the user to enter a filename. Next it should open the file that the user specified. After that it should read in the song data from that file into the song array parameter // Function prototype void LoadSongDataFromFile (Song s[]) ShowSongData Writes ALL data inside the song array to standard output // Function prototype void ShowSongData (Song s]) This function should iterate through the array and calculate the total time for all songs stored in the array Important: The Time that is returned must have seconds less than 60 or it will be marked as incorrect. // Function prototype Time GetTotalTime (Song s]) GetTotalTime Please use the following specifications for your program: 1. Create the structs as listed above. 2. Create the functions as listed above. 3. Create an array of Song in main that has a size of 5. 4. You need to create a loop in main that will show a menu to the user and then do an action based on what the user entered. The menu should be displayed again after it processes the user choice. There is a picture of a sample execution at the end of the homework specifications below. Here is the menu: Song Program 1 - Load song data from file 2 Show all song data 3-Show total time 4 - Exit Enter Choice: Important: You must call the functions that you wrote to do what the user wants done for the given menu selection. Song Input File Format Title ArtistName CountryOfOrigin Minutes Seconds ArtistName CountryOfOrigin Minutes Seconds Song Sample Input Data File (notice there is no descriptive text, just the data) Perfect Ed Sheeran with Beyonce England 4 23 Rockstar Post Malone USA 38 Havana Camila Cabello and Young Thug Cuba 36 Gucci Gang Lil Pump USA 4 Thunder Imagine Dragons USA ong Program -Load song data from file - Show all song data - Show total time Exit nter Choice: 1 nter input filename: songs.txt ong Program - Load song data from file -Show all song data - Show total time - Exit nter Choice: 2 itle: Perfect rtist: Ed Sheeran with Beyonce ountry: England inutes: 4 econds: 23 itle: Rockstar rtist: Post Malone ountry: USA inutes: 3 econds: 38 itle: Havana rtist: Camila Cabello and ountry: Cuba inutes: 3 econds: 36 itle: Gucci Gang rtist: Lil Pump ountry: USA inutes: 2 econds: 4 itle: Thunder rtist: Imagine Dragons ountry: USA inutes: 3 econds: 7 Young Thug ng Program -Load song data from file - Show all song data - Show total time -Exit nter Choice: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started