Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Students in Norfolk Gardens Academy are very excited about the end of year school party. Victoria is playing piano. She is practicing for the
Students in Norfolk Gardens Academy are very excited about the end of year school party. Victoria is playing piano. She is practicing for the end of the school year party every day for a certain amount of time depending on her schedule. It takes her N minutes to practice the first song, and each of following songs takes M minutes longer than the previous song. She has T minutes to practice for all the songs. For example, if the first song takes N = 15 minutes and M = 10, then the second song will take 25 minutes, the third song will take 35 minutes, and so on. If she has 150 minutes to practice the songs, then she can practice four songs because 15 + 25 +35+45 = 120. Design an algorithm and write a C++ program that prompts the user to enter the values of N, M, and T, and outputs the number of songs Victoria can practice. Sample Run 1: Enter the number of minutes to practice first song: -5 Enter the number of minutes to practice first song: 5 Enter how many more minutes to practice the next song: 10 Enter the total time (in minutes) to practice all the songs: 90 In 90 minutes Victoria can practice 4 songs. Sample Run 2: Enter the number of minutes to practice first song: 10 Enter how many more minutes to practice the next song: -5 Enter how many more minutes to practice the next song: 5 Enter the total time (in minutes) to practice all the songs: 100 In 100 minutes Victoria can practice 5 songs. Sample Run 3: Enter the number of minutes to practice first song: 12 Enter how many more minutes to practice the next song: 4 Enter the total time (in minutes) to practice all the songs: 150 In 150 minutes Victoria can practice 6 songs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started