subject

Copy the files Song. java , CompactDisc. java , and Classics. txt into NetBeans or other Java IDE tools. Song. java is complete and will not be edited. Classics. txt is the data file that will be used by CompactDisc. java. We have learned about data file path in Project for chapter 4.Creating a new song with the title and artist and storing it in the appropriate position in the array. Print the contents of the array to the console. 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 StraussThose are the instructions... Now here are the codes:Classic. txtOde to JoyBachThe Sleeping No. 5BeethovenThe Blue Danube WaltzStraussCompactDisc. java/**This program creates a list of songs for a CD by reading from a file*/import java. io.*;public class CompactDisc{ public static void main(String [] args) throws IOException { FileReader file = new FileReader("Classics. txt"); BufferedReader input = new BufferedReader(file); String title; String artist; //Declare an array of songs of size 6 Song [] cd = new Song [6]; for (int i = 0; i < cd. length; i++) { title = input. readLine(); artist = input. readLine(); // Task #2 step 2 - creating a new song with // the title and artist, and store it into the array, like // cd[i] = new Song(title, artist); } System. out. println("Contents of Classics:"); for (int i = 0; i < cd. length; i++) { // Task #2 step 3 - print the contents of the array to the console // using cd[i].toString() to get the contents string } }}Songs. java/*This program represents a song*/public class Song{ /**The title of the song*/ private String title; /**The artist who sings the song*/ private String artist; /**constructor @param title The title of the song @param artist The artist who sings the song */ public Song(String title, String artist) { this. title = title; this. artist = artist; } /**toString method returns a description of the song @return a String containing the name of the song and the artist */ public String toString() { return title + " by " + artist + "\n"; }}Ok.. So I am completely lost on this one... I can't get Netbeans to do anything with this at all.. First off, I don't understand how to read the Classics. txt file in

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 22.06.2019 14:30
What percentage of companies is projected to use social media to locate new employees in 2012
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
You know the right answer?
Copy the files Song. java , CompactDisc. java , and Classics. txt into NetBeans or other Java IDE to...
Questions
Questions on the website: 13722362