Question: import java.io.*; /** This program creates a list of songs for a CD by reading from a file. */ public class Main {

import java.io.*;
/**
This program creates a list of songs for a CD
by reading from a file.
*/
public class Main
{
public static void main(String[] args)throws IOException
{
FileReader file = new FileReader("Classics.txt");
BufferedReader input = new BufferedReader(file);
String title;
String artist;
// ADD LINES HERE
// Declare an array of Song objects, called cd,
// with a size of 6
for (int i = 0; i {
title = input.readLine();
artist = input.readLine();
// ADD LINES HERE
// Fill the array by creating a new song with
// the title and artist and storing it in the
// appropriate position in the array
}
System.out.println("Contents of Classics:");
for (int i = 0; i {
// ADD LINES HERE
// Print the contents of the array to the console
}
}
}
click on Fork to make a copy of the lab. Song.java is complete and will not be edited. Classics.txt is the data file that will be used by Main.java, the file you will be editing. 3. In Main.java, there are comments indicating where the missing code is to be placed. Declare an array of Songs, called cd, with a size of 6. 4. Fill the array by creating a new song with the title and artist and storing it in the appropriate position in the array. 5. Print the contents of the array to the console. 6. Compile, debug, and run. Your output should be as follows: Contents of Classics: Ode to Joy by Bach The Sleeping Beauty by Tchaikovsky Lullaby by Brahms Canon by Bach Symphony No. 5 by Beethoven The Blue Danube Waltz by Strauss
Step by Step Solution
There are 3 Steps involved in it
Here is the modified code with the missing code added java import javaio This program creates a list ... View full answer
Get step-by-step solutions from verified subject matter experts
