Question: Please Write the Pseudocode Like the example I give. Also Do this in Python Please. Program 2: Design (pseudocode) and implement (source code) a program
Please Write the Pseudocode Like the example I give. Also Do this in Python Please.
Program 2: Design (pseudocode) and implement (source code) a program (name it BestDeal) to determine the best deal when buying a small box of apples vs. a large box of apples. The program asks the user to enter the weight and price of each box and then determines which box has a better value. The boxes may have the same value. Document your code and properly label the input prompts and the outputs as shown below.
Sample run 1:
Small box weight: 5 Pounds
Small box price: 10 Dollars
Large box weight: 12 Pounds
Large box price: 18 Dollars
Judgment: The large box is a better deal
Sample run 2:
Small box weight: 5 Pounds
Small box price: 10 Dollars
Large box weight: 10 Pounds
Large box prices: 20 Dollars
Judgment: Both boxes are of the same value
Sample run 3:
Small box weight: 5 Pounds
Small box price: 10 Dollars
Large box weight: 10 Pounds
Large box price: 28 Dollars
Judgment: The smaller box is a better deal
pseudocode example:
Design (pseudocode) and implement (source code) a program (name it Distance) to compute the distance between 2 points. The program prompts the user to enter 2 points (X1, Y1) and (X2, Y2). The distance between 2 points formula is:
Square_Root [(X2 X1)^2 + (Y2 Y1)^2]
Document your code, properly label the input prompts, and organize the outputs as shown in the following sample runs.
Sample run 1:
Entered X1: 1.5
Entered Y1: -3.4
Entered X2: 4
Entered Y2: 5
Distance: 8.764131445842194
Sample run 2:
Entered X1: -5.5
Entered Y1: -8.8
Entered X2: 25
Entered Y2: 4.5
Distance: 33.27371334852784
Sample run 3:
Entered X1: 2
Entered Y1: 2
Entered X2: 10
Entered Y2: 10
Distance: 11.313708498984761
Pseudocode:
BEGIN MAIN
CREATE x1, x2, y1, y2, distance
READ user input
x1 first number entered
x2 second number entered
y1 third number entered
y2 fourth number entered
distance sqrt((x2 x1) ^ 2 + (y2 y1) ^2) sqrt = square root, ^ = to the power of
PRINTLINE(Entered X1: + x1 )
PRINTLINE(Entered Y1: + y1 )
PRINTLINE(Entered X2: + x2 )
PRINTLINE(Entered Y2: + y2 )
PRINTLINE(Distance: + distance)
END MAIN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
