Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions