Write a pseudocode...
A program is to be developed that will calculate the total length of music to be stored on a CD. Assume a CD may store 76 minutes of music. The user will enter the length of musical tracks in minutes and seconds (separately) in a loop. A loop will be used to prevent the user from entering a negative value for the minutes value; and a loop will be used to force the user to enters a seconds value in the range of 0 to 59 inclusive. The length of each track will be added to the sum of minutes and seconds that are stored on the CD. If the number of seconds, when summed, exceeds 59, add one to the minutes value and adjust the seconds accordingly.
After the length of each track is entered, the user will be asked if they wish to enter another track. If the user responds with no, then the sum of the time will be displayed. If the user answers yes, then another track will be entered only if the current sum is less than 76 minutes. If the current sum exceeds 76 minutes, track input will end, and the total sum will be displayed. After the total sum of the time is displayed, the program will end.

So Far i have this and im not sure if this right.

Do
Input track music in minutes
Input track music in seconds
If (second >= 0) || (second <= 59)
Then
Display the seconds
Else (seconds > 59)
Add one minute to input minutes.
Ask the user to put the track music.
Input user Response of yes or no.
While (Response == no)
Display the Result:
Input minute: Input second

Recommended Answers

All 2 Replies

you should probably use && instead of || on the 4th line. Also, on the 8th line you should calculate how many minutes to add, instead of just adding 1 (the user could enter 1000 seconds or something like that.) and after that you should change the seconds to fit within 0 <= seconds <= 59

Thank you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.