Question: Problem Statement: You have won a $ 1 0 0 gift certificate to buy your five favorite albums. The total cost of all albums must

Problem Statement: You have won a $100 gift certificate to buy your five favorite albums. The total cost of all albums must be $100 or less.
Modules trying to create:
1.main.
2. Calls inputAlbumCosts.
inputAlbumCosts. Uses a loop to input the costs of your five favorite albums. Accumulates the total cost as you input the price of each album.
3. Calls withinBudget.
withinBudget. Accepts the total cost of your albums and determines if you are within budget. Displays the total cost and displays a message indicating either that you are within budget or have exceeded $100 limit.
4. Calls averageCost.
averageCost. Accepts the total cost of the five albums. Calculates and displays the average cost of each album.
Output Trying to Create:
Please enter the cost of album 1: 20.00
Please enter the cost of album 2: 12.00
Please enter the cost of album 3: 25.00
Please enter the cost of album 4: 8.00
Please enter the cost of album 5: 13.00
The total cost is $78.
This is within budget!
The average cost of each album is 15.60.
My Pseudocode:
Module main()
Call calculateAlbumCosts(totalCost)
Call displayCostAndBudgetStatus(totalCost)
Call calculateAndDisplayAverageCost(totalCost)
End Module
Module calculateAlbumCosts (Real totalCost)
Declare Real albumCost, totalCost
Declare Integer i
Set totalCost =0
Display ""
Input albumCost
For i =1 To 5
Set totalCost = totalCost + albumCost
End For
Call displayCostAndBudgetStatus(totalCost)
End Module
Module calculateAndDisplayAverageCost (Real totalCost)
Declare Real averageCost
Set averageCost = totalCost /5
Display "The average cost of each album is: ", averageCost
End Module
Module displayCostAndBudgetStatus (Real totalCost)
Declare Integer counter
Display "The total cost is $: ", totalCost
If totalCost <=100 Then
Display "This is within budget!"
Else
Display "You are over budget!"
End If
Call calculateAndDisplayAverageCost(totalCost)
End Module
Thank you for taking the time to look at this problem. I am having trouble running my program in flowgorithm and trying to understand the error in my pseudocode. How do I fix this to make this program run and fix the pseudocode. Especially in how to make the modules all work in sequence. Thanks again.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!