Assignment 20
Due Tuesday, March 17 at 11:20am on Canvas
Important: To receive credit, you must only use concepts and methods taught in class to complete these assignments
Pair Programming (Worth +1 Extra Credit)
- Both partners fill in, sign, date, and submit the pair programming contract
- Upload the document(s) along with your assignment code to Canvas.
- No extra credit if you do not submit the contract along with your 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.
How to Get Help: - Office hours (Monday at 8:30am, Tuesday at 10:30am, Wednesday at 11:30 in F5-1F + Tuesday, Wednesday, and Thursday at 5:00pm online)
- Alyssa's office hours: Wednesday 2:30 to 4:30pm in ATC 203
- Dyllon's office hours: Tuesday and Thursday 3:30pm to 5:20pm in ATC 203
- Roee's office hours: Tuesday and Thursday 1:30pm to 3:30pm in ATC 203
- Email
- Get help from a TA or tutor in ATC 203 computer lab - sign in at the front desk for help
Assignment 20: 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. - Both partners need to submit for full credit.
|
|