Question: Convert the pseudocode into Visual Basic code. Module main() ?2 // Local variable ?3 Declare String doAnother ?4 ?5 Do ?6 // Calculate and display

Convert the pseudocode into Visual Basic code.
Module main()
?2 // Local variable
?3 Declare String doAnother
?4
?5 Do
?6 // Calculate and display a retail price.
?7 Call showRetail()
?8
?9 // Do this again?
10 Display "Do you have another item? (Enter y for yes.)"
11 Input doAnother
12 While doAnother == "y" OR doAnother == "Y"
13 End Module
14
15 // The showRetail module gets an item's wholesale cost
16 // from the user and displays its retail price.
17 Module showRetail()
18 // Local variables
19 Declare Real wholesale, retail
20
21 // Constant for the markup percentage
22 Constant Real MARKUP = 2.50
23
24 // Get the wholesale cost.
25 Display "Enter an item's wholesale cost."
26 Input wholesale
27
28 // Validate the wholesale cost.
29 While wholesale < 0
30 Display "The cost cannot be negative. Please"
31 Display "enter the correct wholesale cost."
32 Input wholesale
33 End While
34
35 // Calculate the retail price.
36 Set retail = wholesale * MARKUP
37
38 // Display the retail price.
39 Display "The retail price is $", retail
40 End Module
Programs output should be:
Enter an item's wholesale cost.
0.50 [Enter]
The cost cannot be negative. Please
enter the correct wholesale cost.
0.50 [Enter]
The retail price is $1.25
Do you have another item? (Enter y for yes.)
n [Enter]

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 Databases Questions!