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: Pseudocode Sample Description: This logic

ID: 3760785 • Letter: P

Question

Part 1

Examine the pseudocode sample:

Pseudocode Sample

Description: This logic applies 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.

Explanation / Answer

Solution using pseudocode similar to what you saw in part 1 in java is shown below as:

class applyDiscount
{
   public static void main (String[] args) throws java.lang.Exception {
       double productPrice, discount, wholesalePrice, discountedPrice;
        Scanner s = System.in();
       s.productPrice;
       s.discount;
       s.wholesalePrice;
       discountedPrice = productPrice * (1 –discount);
       if (discountedPrice < wholesalePrice){
           discountedPrice = wholesalePrice;
       }
       System.out.println(discountedPrice);
   }
}

For part 2, the pseudocode is as provided below:

Program: paymentOption
   Create variable selectpaymentOption as int
   Create variable AccountNumber as long int
   Create variable RoutingNumber as int
   Create variable ExpirationDate as DateVariable in Java
   Create variable CVV as int
   Create a switch statement
   Give user the 2 choices as in cases in swithch statement
   Case1: Electronic Check
       RoutingNumber = get value from user input
       AccoountNumber = get value from user input
       Alert("Make Payment")
   end Case1
  
   Case2: Credit Card
       AccoountNumber = get value from user input
       ExpirationDate = get value from user input
       CVV = get value from user input
       Alert("Make Payment")
   end Case2
   Display "Transaction Complete"
End program