a. Define a class which represents a high school student. The structure shall have the
following fields. A string which representing the student’s name, an integer
representing the students ID #, a integer representing the number of credits the
student has earned, and a float representing their grade point average.
b. Declare an instance of the class. Initialize the data fields to the following data:
Name Ferris Bueller
Credits Earned 180
Page 2 of 4
a. Write a class which represents a tire and contains the following information: a string
representing the brand name, an integer representing the width, an integer
representing the diameter, and an integer representing the aspect ratio.
b. Write a class which represents a car. The class shall contain the following
information: an array of size four of the tire objects created in step A, and strings
representing the car make and model, and an integer representing the year.
c. Declare an instance of the car class created in step B. Initialize the data in the
structure to be the following:
Tire Set Field Tire Field Value
tire and tire
brand Cobra Radial G/T
aspect ratio 70
tire and tire
aspect ratio 70
Make N/A Fiat
Model N/A 124 Spider
Year N/A 1976
Page 3 of 4
3. (Upload as Source) The following program will be used to build a program which will
implement a hypothetical iTunes player. The program will be built piece-wise over the
course of several homework assignments. Therefore keep your files after this submission.
Figure 1 Diagram of ITunes Program
The above diagram represents the classes which will be used to create the final program.
These classes include library, player, song, and user interface. The program will use file IO to
populate the library full of songs, and a user interface will be used so that the user will be
able to play a song using the player class. Hopefully by the time the project is done you will
have a fully working music player.
For the current assignment you will implement the Song class, and write some code which
will eventually be used for the library.
a. Write a Song class which contains the following fields:
i. string representing the file location
ii. string representing the song name
iii. string representing the artist name
iv. int representing the length of the song in seconds
b. The file, songlist.txt, contains a list of songs and is provided. The format of the file is
i. line 1: file location
ii. line 2: Song Name
iii. line 3: Artist Name
iv. line 4: Song Length
c. The above file format is then repeated for each song.
d. In the main function do the following:
i. Declare an array of Song objects of size 10.
ii. Read in the contents of the file and store each song’s information as an
object in the array created in the previous step.
iii. Only part of the array will be used. Therefore while reading from the file
track how many songs were read in using a counting variable.
Page 4 of 4
iv. After the reading is complete, print the information of each song excluding
the file location to the console in a tabular form as shown below.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
using namespace std;
student(string name, int id, int credits, double avg)
this->name = name;
this->ID = id;
this->credits = credits;
this->GPA = avg;