Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 1 Examine the pseudocode sample provided, and explain what it does line by

ID: 3686971 • Letter: P

Question

Part 1

Examine the pseudocode sample provided, and explain what it does line by line. Please Use the table provided in the following page.

Unit 2 Pseudocode Sample

Description: this logic applies a discount on an item price

Program: applyDiscount

Create variable productPrice as double

Create variable discount as double

Create variable discountedPrice as double

productPrice = get value from user input

discount = get value from user input

discountedPrice = productPrice * (1 - discount)

Display discountedPrice

End program

Line of code    Please insert your explanation

Description: This logic applies a discount on an item price ?

Program: applyDiscount ?

Create variable productPrice as double ?

Create variable discount as double ?

Create variable discountedPrice as double ?

productPrice = get value from user input ?

discount = get value from user input ?

discountedPrice = productPrice = productPrice * (1 - discount) ?

Display discountedPrice ?

End program ?

Part 2

Present a solution using pseudocode similar to what you saw in Part 1

Identify the logic needed to capture a credit card payment where the user provides their account number, expiration date and CVV code from the back of the card.

Remember to declare all variables and their data types.

The information captured should be printed to the screen.

Insert your Pseudocode here

Explanation / Answer

Description: This logic applies a discount on an item price -> Explains the description of the program

Program: applyDiscount -> Probable program name

Create variable productPrice as double -> declaration of productPrice variable as double. It stores price of product

Create variable discount as double -> declaration of discount variable as double. It stores the discount ratio for product

Create variable discountedPrice as double -> declaration of discountedPrice as double. It stores total discount amount for the product

productPrice = get value from user input -> takes user input for price of product and stores it in productPrice variable

discount = get value from user input -> takes user input for discount ratio for product and stores it in discount variable

discountedPrice = productPrice = productPrice * (1 - discount) -> calculates the total discount for the product and stores it in discountedPrice variable

Display discountedPrice -> Finally it displays discountedPrice value to user

End program -> End of the program

___________________________________________________________________________________________

Description: This logic captures credit card details

Program: CreditCardPayment

create variable accountNumber as string

create variable expirationDate as string

create variable CVV as integer

accountNumber = get value from user input

expirationDate = get value from user input

CVV = get value from user input

Display "Credit card payment done on "

Display accountNumber

Display expirationDate

Display CVV

End Program