Line 1: Description: This logic applies a discount on an item price Line2: Progr
ID: 3783215 • Letter: L
Question
Line 1: Description: This logic applies a discount on an item price Line2: Program: applyDiscount Line3: Create variable productPrice as double Line4: Create variable discount as double Line 5: Create variable discountedPrice as double Line6: productPrice = get value from user input Line7: discount = get value from user input Line8: discountedPrice = productPrice * (1 - discount) Line 9: Display discountedPrice Line 10: End program For the Pseudocode sample above, explain what it does line by line in the following table. For example, for Line3, you may explain: Create a variable named productPrice with double as the data type. Unit 3 Pseudocode Sample Line 1: Description: This logic applies a discount on an item unless the discounted price is less than the whole sale price Line2: Program: applyDiscount Line3: Create variable productPrice as double Line4: Create variable discount as double Line 5: Create variable wholesalePrice as double Line6: Create variable discountedPrice as double Line 7: productPrice = get value from user input Line8: discount = get value from user input Line9: wholesalePrice = get value from user input Line 10: discountedPrice = productPrice * (1 - discount) Line 11: if (discountedPriceExplanation / Answer
lines explanation
line 1 description of a program
line 2 name of the program for discount
line 3 here declaring product price variable as double and store price of product
line 4 here declaring discount variable as double and stores the discount ratio of thre product
line 5 here declaring wholesale price variable as double and store price of product
line 6 declation of discount variable as double and stores the discount amount of thre product
line 7 in product price variable it stores the price o product and takes userinput
line 8 in discount variable it stores the total discount product and takes userinput
line 9 in wholesaleprice variable it stores the total wholesale price product and takes userinput
line 10 calculates total discount for the product and stores in discounted price variable
line 11 checks the condition that if discounted price is less than wholesaleprice
line 12 if condition satisfies then both discountedprice as wholesale prices are equal
line 13 closing the condition
line 14 displays the discounted value to the user
line 15 end of program
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.