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 $ gift certificate to buy your five favorite albums. The total cost of all albums must be $ or less.
Modules trying to create:
main.
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.
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 $ limit
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 :
Please enter the cost of album :
Please enter the cost of album :
Please enter the cost of album :
Please enter the cost of album :
The total cost is $
This is within budget!
The average cost of each album is
My Pseudocode:
Module main
Call calculateAlbumCoststotalCost
Call displayCostAndBudgetStatustotalCost
Call calculateAndDisplayAverageCosttotalCost
End Module
Module calculateAlbumCosts Real totalCost
Declare Real albumCost, totalCost
Declare Integer i
Set totalCost
Display
Input albumCost
For i To
Set totalCost totalCost albumCost
End For
Call displayCostAndBudgetStatustotalCost
End Module
Module calculateAndDisplayAverageCost Real totalCost
Declare Real averageCost
Set averageCost totalCost
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 Then
Display "This is within budget!"
Else
Display "You are over budget!"
End If
Call calculateAndDisplayAverageCosttotalCost
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
