Assignment 18
Due Friday, June 19 at 11:59pm on Canvas
Important: To receive credit, you must only use concepts and methods taught in class to complete these assignments - or you will receive a 0.
Pair Programming Required (or You Will Receive a 0)
- Both partners fill in, sign, date, and submit the pair programming contract
- Upload the document(s) along with your Lab code to Canvas.
- Please make sure both your names are on your file (hint: use a comment).
- If you need help finding a partner, please contact me as soon as possible.
Assignment 18: Billboard Top Songs (10 pts) - In
this assignment, you and your partner will write a program that stores 10 Strings in a
String
array -- representing the Billboard top 10 songs of March, 2020 -- and 10
doubles in a double array (duration of the song) and then writes the
contents of
the two arrays to an output file.
- Create a new Java file, and save it as
Billboard.java .
- At the top of main declare a String array named titles of length 10.
- Then, declare a double array of length 10 named durations.
- Create a new input file inside your project folder and name it names.txt. Then, save the following names in the file:
The Box
Life is Good
Don't Start Now
Circles
Stupid Love
Roxanne
Blinding Lights
Dance Monkey
Memories
Intentions
- Next, write a for loop to read in each song name for the input file and save it in the titles array
- When you are finished, close the Scanner. You can re-open it to read in the next file.
- Create a second input file named durations.txt, and save the following doubles in the file:
1.54 3.26 3.14 3.43 3.20 2.42 2.38 3.16 3.45 3.28
The Box (1.54) Life is Good (3.26)
Don't Start Now (3.14)
Circles (3.43) Stupid Love (3.20)
Roxanne (2.42)
Blinding Lights (2.38) Dance Monkey (3.16)
Memories (3.45)
Intentions (3.28) - Finally, compile and run your code and verify that you get the following inside of songData.txt:
Billboard Top 10 Tracks of March 2020:
The Box (1.54) Life is Good (3.26)
Don't Start Now (3.14)
Circles (3.43)
Stupid Love (3.20)
Roxanne (2.42)
Blinding Lights (2.38)
Dance Monkey (3.16)
Memories (3.45)
Intentions (3.28) - Submit your
Billboard.java program to Canvas when you are finished.
|
|