Question: Java 1 Help Needed In this assignment we will write a program that stores 10 Strings in a String array -- representing the Billboard top
Java 1 Help Needed
- In this assignment we will write a program that stores 10 Strings in a String array -- representing the Billboard top 10 songs of March, 2021 -- and 10 doubles in a double array (duration of the song) and then writes the contents of the two arrays to the console.
- Create a new Java file, and save it as Songs.java.
- At the top of main declare a String array named songs of length 10, and store the following contents in the array.
-
"drivers license"
"Up"
"Go Crazy"
"34+35"
"Blinding Lights"
"Save Your Tears"
"Mood (feat. iann dior)"
"Calling My Phone"
"Positions"
"Levitating (feat. DaBaby)"
- Then, declare a double array of length 10 named lengths, and store the following contents in the array:
4.02 2.36 2.56 2.53 3.20
3.35
2.20
3.25
2.53
3.23
- Now, inside of main, add the following print statement:
out.println("Billboard Top 10 Tracks:"); //assuming PrintWriter named out
- Copy and paste the below Javadoc comment and method signature outside of main:
/**
* Prints out the values of two arrays side-by-side
* @param array1 the first array to print
* @param array2 the second array to print
*/
public static void printArrays(String array1[], double array2[]){
//fill in method body here!
}
- Next, fill in the method body to print out the the two arrays inside of a file named songs.txt, in the following format:
drivers license - length: 4.02
Up - length: 2.36
Go Crazy - length: 2.56
34+35 - length: 2.53
Blinding Lights - length: 3.20
Save Your Tears - length: 3.35
Mood (feat. iann dior) - length: 2.20
Calling My Phone - length: 3.25
Positions - length: 2.53
Levitating (feat. DaBaby) - length: 3.23
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
