Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are burning some music CDs for a party. You\'ve arranged a list of songs in

ID: 3663738 • Letter: Y

Question

You are burning some music CDs for a party. You've arranged a list of songs in the order in which you want to play them. However, you would like to maximize your use of space on the CD, which holds 80 minutes of music. So, you want to figure out the total time for a group of songs and see how well they fit. Write and design a Java program to help you do this. The time is entered as seconds. After all the data has been read, the application should print a message indicating the time remaining on the CD.

Explanation / Answer


import.java.io.*

import.java.util.scanner

class CD

{

int songMin=0;

int SongSec=0;

int totalmin=0;

int totalsec=0;

java.util.scanner scn=new java.util.scanner(System.in);

int i=scn.nextInt();

int used min,used sec;

int songnum;

int currentMinutes=0;

int currentSeconds=0;

InputStream my input=new FileInputstream(“c:\songs.dat”);

Scanner my InputFile=new Scanner(myInput);

while(!inData)

{

System.out.println(“can’t open the file”);

song s=new song;

s.get();

return 1;

}

System.out.println(“song time”);

System.out.println(“total time”);

songnumber=1;

while(current>59)

{

int n;

n=current/60;

n=current%60;

}

if(current>59)

{

System.out.println(“currentMinutes”);

System.out.println(“currentSeconds”);

}

totalMinutes=(usedMinutes+currentMinutes);

totalSeconds=(usedSeconds+currentSeconds);

total =(usedMinutes+currentMinutes)

usedTime=(totalMinutes*60+totalSeconds);

minutesLeft=(totalTime-usedTime);

secondsLeft=(totalTime-usedTime);

totalTime=(80*60);

System.out.println(“left in 80 minutes”);

System.out.println(“time remaining on CD”);

return 0;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote