// This pseudocode is based on the pseudocode from project #2. It is possible your logic, variables names from project may be different from 2 //below. That is ok. You just need to adjust your project #4 to match the logic below. Recall,, you should no t have to create new variables 3 //since your project #2 is already working. You are just converting the logic to using functions. No assumptions. Ask me questions 9/2022 4 Import welcome message Module 5 Import retail price Module 6 7 Function main() 8 Declare Variables (see project #2) 9 Call quantity =Input_Packages() 10 Call discountrate=Determine_Discount(quantity) 11 Call fullprice=Calculate_Fullprice(quantity) 12 Call discountamount=Calculate_Discount(fullprice, discountrate) 13 Call totalamount=Calculate_totalamount(fullprice, discountamount) 14 Call Print_Amounts(discountamount, totalamount) 15 //End of function main() 16 17 Function Input_Packages() 18 Input quantity 19 return quantity 20 // End of function Input_Packages() 21 22 Function Determine_Discount(quantity) 23 discountrate=0.0 24 if quantity> 99 then 25 Set discountrate = 0.50 26 elseif quantity > 49 then 27 Set discountrate = 0.40 28 elseif quantity > 19 then 29 Set discountrate=0.30 30 elseif quantity> 9 then 31 Set discountrate=0.20 32 else 33 discountrate=0.0 34 return discountrate 35 //End of function Determine_Discount() 36 37 Function Calculate_Fullprice(quantity) 38 Set fullprice=quantity*RETAIL_PRICE(get from Module) 39 return fullprice 40 // End of unction Calculate_Fullprice() 41 42 Function Calculate_Discount(fullprice, discountrate) 43 // calculate the discount amount 44 Set discountamount = fullPrice * discountrate 45 return discountamount 46 47 Function Calculate_totalamount(fullprice, discountamount) 48 // calculate the total amount 49 Set totalAmount = fullPrice -discountamount 50 return totalamount 51 // End of function Calculate_totalamount() 52 53 Function Print_Amounts(discountamount, totalamount) 54 // Print results 55 Print "Discount Amount is", discountAmount Print ""Total Amount is: ", totalamount 56 Print ""Total Amount is: ", totalamount 57 // end of function Print_Amounts() 58 59 Call main() 60 Print(“program over”)

CMPTR
3rd Edition
ISBN:9781337681872
Author:PINARD
Publisher:PINARD
Chapter18: Maintaining And Querying A Database
Section: Chapter Questions
Problem 12QY
icon
Related questions
Question

1 // This pseudocode is based on the pseudocode from project #2. It is possible your logic, variables names from project may be different from
2 //below. That is ok. You just need to adjust your project #4 to match the logic below. Recall,, you should no t have to create new variables
3 //since your project #2 is already working. You are just converting the logic to using functions. No assumptions. Ask me questions 9/2022
4 Import welcome message Module
5 Import retail price Module
6
7 Function main()
8 Declare Variables (see project #2)
9 Call quantity =Input_Packages()
10 Call discountrate=Determine_Discount(quantity)
11 Call fullprice=Calculate_Fullprice(quantity)
12 Call discountamount=Calculate_Discount(fullprice, discountrate)
13 Call totalamount=Calculate_totalamount(fullprice, discountamount)
14 Call Print_Amounts(discountamount, totalamount)
15 //End of function main()
16
17 Function Input_Packages()
18 Input quantity
19 return quantity
20 // End of function Input_Packages()
21
22 Function Determine_Discount(quantity)
23 discountrate=0.0
24 if quantity> 99 then
25 Set discountrate = 0.50
26 elseif quantity > 49 then
27 Set discountrate = 0.40
28 elseif quantity > 19 then
29 Set discountrate=0.30
30 elseif quantity> 9 then
31 Set discountrate=0.20
32 else
33 discountrate=0.0
34 return discountrate
35 //End of function Determine_Discount()
36
37 Function Calculate_Fullprice(quantity)
38 Set fullprice=quantity*RETAIL_PRICE(get from Module)
39 return fullprice
40 // End of unction Calculate_Fullprice()
41
42 Function Calculate_Discount(fullprice, discountrate)
43 // calculate the discount amount
44 Set discountamount = fullPrice * discountrate
45 return discountamount
46
47 Function Calculate_totalamount(fullprice, discountamount)
48 // calculate the total amount
49 Set totalAmount = fullPrice -discountamount
50 return totalamount
51 // End of function Calculate_totalamount()
52
53 Function Print_Amounts(discountamount, totalamount)
54 // Print results
55 Print "Discount Amount is", discountAmount Print ""Total Amount is: ", totalamount
56 Print ""Total Amount is: ", totalamount
57 // end of function Print_Amounts()
58
59 Call main()
60 Print(“program over”)

 

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Hiring Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning