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

You are putting together some music tapes for a party. You\'ve arranged a list o

ID: 3528622 • Letter: Y

Question

You are putting together some music tapes 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 minimize the empty tape left at the end of each side of a cassette

(the cassette plays 45 minutes a side). So you want to figure out the total time for a group of songs and see

how well they fit. Write a program that should input a song number and a time for each song until it encounters

a song number of 0. The times should be each be entered as minutes and seconds (two integer values). The

program should echo print the data for each song and the current running time total. The last data entry (song

number 0) should not be added to the total time. After all the data has been read, the program should print a

message indicating the time remaining on the tape. The program should discard any invalid data sets (negative

numbers, for example) and print an error message indicating that the data set has been discarded and what

was wrong with it.

For example,

Enter the song number:

1

Enter the number of minutes:

5

Enter the number of seconds:

10

Song number 1, 5 minutes and 10 seconds

Total time is 5 minutes and 10 seconds.

For the next song.

Enter the song number:


Use C language

Explanation / Answer

#include#include void main() { int i, min,sec,totmin=0,totsec=0; while(1) { printf("Enter the song number:"); scanf("%d",&i); if (i==0) { break; } printf("Enter the number of minutes); scanf("%d",&min); printf("Enter the number of seconds"); scanf("%d",&sec) ; totmin+=min; totsec+=sec; if (totsec>60) { totmin+=1; totsec-=60; } printf("song number %d, %d minutes and %d seconds",i,min,sec); printf("Total time is %d minutes and %d seconds", totmin,totsec); if( (totmin*60+totsec)>2700) { printf(" Invalid dataset as the cassette can play only for 45 minutes It is over the time"); exit(); } printf("For the next song"); } printf("Total time is %d minutes and %d seconds", totmin,totsec); getch(); }

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