Write a program to process a
file containing information about your music collection. Each song in your song
library will have a name, artist, and length (in seconds). Read this data into
three arrays, two for strings (for title and artist) and one for integers (for
length). Then perform the processing below.
Use at least the REQUIRED
METHODS listed below, with the exact same SPELLING for method names and
parameters. You are free to add any other methods.
The name of the input file
MUST BE SPELLED EXACTLY AS Music.txt. Any deviations will result in a ZERO as none of my test
cases will work. The file starts with an integer on the first line that
specifies the song count. Each line afterwards represents a song. The song
lines will be formatted thus:
Time:Title:Artist
For example, the file might
contain the following data:
5
212:Float
On:Modest Mouse
259:Cherub
Rock:Smashing Pumpkins
351:The
Price You Pay:Bruce Springsteen
417:Teen
Age Riot:Sonic Youth
285:Portions
for Foxes:Rilo Kiley
Use PRECISELY the file format
described above.
The colons delimit the data
on each line, which allows us to have spaces in artist and song names. You can
use the colons to separate the three fields so you can place each one in the
proper array (see the Hints section).
Output the data from the file
in three columns, in the order of title, artist, and time. Left justify the
title and artist in a field of 24 characters (%-24s). Right justify the time in a field of 4 characters (%4d).
Get Free Quote!
417 Experts Online