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: 3691245 • Letter: P

Question

Part 1

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

Click here to access the sample. Note that this example is built on top of the one provided in week 2.

UNIT 3 PSEUDOCODE SAMPLE

Description: This logic apples a discount on an item unless the discounted price is less than the whole sale price

Program: applyDiscount

     Create variable productPrice as double

     Create variable discount as double

     Create variable wholesalePrice as double

     Create variable discountedPrice as double

     productPrice = get value from user input

     discount = get value from user input

     wholesalePrice = get value from user input

     discountedPrice = productPrice * (1 - discount)

       if (discountedPrice < wholesalePrice)

       discountedPrice = wholesalePrice

     end if

     Display discountedPrice

End program

Part 2

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

   Identify the logic needed to select a payment option, and get payment details.

   The logic needs to capture the payment option from the user.

   Two options should be available for the user to select from:

         Electronic check with routing number and account number

         Credit card with account number, expiration date and CVV code

The logic should check the selected option using a decision-making statement and provide the corresponding statements to capture the payment information based on the selection.

       Insert Pseudocode below

Explanation / Answer

Pseudocode for Part-2

Program: Payment

    Declare variable paymentType as integer
    Declare variable rountingNumber as integer
    Declare variable accountNumber as integer
    Declare variable expiryDate as string
    Declare variable CVV as integer

    Display "payment choice"
    Display "1.Check "
    Display "2.Credit card"
    paymentType=Get value from user input

    if paymentType==1

   rountingNumber =Get value from user input
   accountNumber =Get value from user input  

   else if paymentType==2

          accountNumber =Get value from user input
          expiryDate = Get value from user input
           CVV =Get value from user input

   end if

End program