Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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
Check Mark
Step 1

The given pseudo code is implemented as a Java program.

  • There are five functions:
    • Input_Packages()
    • Determine_Discount(quantity)
    • Calculate_Fullprice(quantity)
    • Calculate_Discount(fullprice, discountrate)
    • Calculate_totalamount(fullprice, discountamount)
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education