
Concept explainers
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”)

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)
Step by stepSolved in 3 steps with 3 images

- "type" alone is not enough to describe a variable. You can tell what a variable is by its data type and other things about it. The next step is to figure out how to use this idea to describe any given variable.arrow_forwardhelparrow_forwardCan this by done using Code C and must include clear comments as well please?! The exercise is about keeping track of the points for a 6 team sports league during a season, perhaps a “5-a-side” football league, in which the goals scored by each team should be recorded. Take some time before diving into theprogramming. First, assess what the program is required to do and how you will go about producing it. Develop and test your program step by step. Your completed program should:1. Prompt the user and read in the number of a team playing the current game, i.e. Team 1,Team 2, Team 3, etc.2. Prompt the user and read in the number of the opponent team. It is probably helpful to thinkof the first team as the home team for this game, and the second team as the away team.3. Prompt the user and read in a team’s score for the current game. Use the team’s numberwhen asking for the score in your printf statement.4. Prompt the user and read in the opponent’s score for that game. Again, use the…arrow_forward
- Overview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for a higher/lower game. This will give you practice designing a more complex program and allow you to see more of the benefits that designing before coding can offer. The higher/lower game will combine different programming constructs that you have been learning about, such as input and output, decision branching, and a loop. Higher/Lower Game DescriptionYour friend Maria has come to you and said that she has been playing the higher/lower game with her three-year-old daughter Bella. Maria tells Bella that she is thinking of a number between 1 and 10, and then Bella tries to guess the number. When Bella guesses a number, Maria tells her whether the number she is thinking of is higher or lower or if Bella guessed it. The game continues until Bella guesses the right number. As much as Maria likes playing the game with Bella, Bella is very excited to play the game…arrow_forwardWe are interested in developing an application for managing roadside assistance for malfunctioned vehicles on roads. The system aims to automate the process and efficiently provide help. To be able to use the system, the customer should be registered in the system. Registration details include the customer's name and phone number. Moreover, the customer should register the vehicles he wants to have in the roadside assistance program. The customer can register as many cars as he wants. The customer should enter each registered vehicle's make, model, year, and plate number. At any point in time, the customer can request assistance using the system. Assistance types may include basic repair, tire change, gas refill, oil services, and towing to a service center. Each service has a price and may include buying some parts. Each part has its own price, and the service might require multiple parts of the same type. Multiple providers can offer the same service. The system should automatically…arrow_forwardA brief explanation of call by value versus call by reference would be helpful. Sincerely,arrow_forward
- It is not sufficient to declare a variable using the word "type" alone. Identifiers may be derived from a variable's data type as well as other aspects of its makeup. The next thing that has to be done is to find out how to characterise any given variable by employing this concept.arrow_forwardLook over Python assignment and answer one question. Hi, I have attached both the assignment directions and a copy of my work so far. I wanted to make sure I was properly explaining the results. I also don't understand why the last print statement, print(2//3) has a result of zero instead of 8. Thanks so much.arrow_forwardYou must use one other model (math/random).arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





