Question: Variable not initialized: The variable 'totalCost' was not initialized. How do I fix this to make the program run. Psuedocode: Module main ( ) Declare
Variable not initialized: The variable 'totalCost' was not initialized. How do I fix this to make the program run.
Psuedocode:
Module main
Declare Real totalCost
Call calculateAlbumCoststotalCost
Call displayCostAndBudgettotalCost
End Module
Module calculateAlbumCosts Real totalCost
Declare Real albumCost, totalCost
Declare Integer i
Set totalCost
Display "Enter the cost of album:
Input albumCost
For i To
Set totalCost totalCost albumCost
End For
Call displayCostAndBudgettotalCost
End Module
Module displayCostAndBudget Real totalCost
Declare Real totalCost
Display "The total cost is $: totalCost
If totalCost Then
Display "This is within budget!"
Else
Display "You are over budget!"
End If
End Module
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
