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

Narmal Instructions Update the class Lemonadestand from your BA2 assignment to i

ID: 3744966 • Letter: N

Question

Narmal Instructions Update the class Lemonadestand from your BA2 assignment to include the following 1. Change the price per glass of lemonade to a constant variable. Also be sure to rename the variable to show the proper naming convention for constant variables. [1 point] 2. Using a switch statement: 12 points) If the payment type is C or c, then display "Credit card transaction' on the If the payment type is D or d, then display "Debit card transaction" on the If the payment type is M or m, then display "Money transaction on the . If the payment type is V or v, then display "Venmo transaction" on the screen screen screen screen If the payment is none of the above, then display Invalid payment type on the screen, and end the program with System.exití1); 3. Using a single if-else-if statement 13 points . If the user paid via credit card or debit card, then charge a s0.50 credit/debit fee. Add that fee to the total, and display the new total on the screen. If the user paid via money (cash) and the total is S5 or more, then give a 10% discount. If the total is less than $5, then no discount will be given. Subtract that discount from the total, and display that new total on the screen. If the user paid via Venmo and the total is more than $10, then tell the user they earned a free glass of lemonade Fxamnle Outnut tucer innut is in nreen) Words: 315 of 315L CPages:1 of 2 MacBook Pro

Explanation / Answer

Since there is no mention of the earlier class I am going to write a fresh class that will implement all this written here.

import java.util.*;

import java.lang.*;

import java.io.*;

class LemonadeStand

{

public static void main (String[] args) throws java.lang.Exception

  {

    Scanner sc = new Scanner(System.in);

      System.out.println("Welcome to lemon stand, what is your name?");

      final double price = 1.75;

      String s = sc.nextLine();

      System.out.println("Hi "+s+" how many glass of leamonade would you like? They are $"+price+" each");

      double q = sc.nextInt();

      System.out.println("How will you be paying today?");

      sc.nextLine();

      char c = sc.next().charAt(0);

      switch(c){

          case 'C':

              System.out.println("Credit card transaction");

              break;

          case 'c':

              System.out.println("Credit card transaction");

              break;

          case 'D':

              System.out.println("Debit card transaction");

              break;

          case 'd':

              System.out.println("Debit card transaction");

              break;

          case 'M':

              System.out.println("Money transaction");

              break;

          case 'm':

              System.out.println("Money transaction");

              break;

          case 'V':

              System.out.println("Venmo transaction");

              break;

          case 'v':

              System.out.println("Venmo transaction");

              break;

          default:

              System.exit(1);

      }

      if(c=='D' || c=='d'){

          double x = price * q + 0.5;

          System.out.println("There will be a $0.50 fee for using debit card. You new totoal is $"+x+". Thanks and have a nice day.");

      }

      else if(c=='C' || c=='c'){

          double x = price * q + 0.5;

          System.out.println("There will be a $0.50 fee for using credit card. You new totoal is $"+x+". Thanks and have a nice day.");

      }

      else if(c=='M' || c=='m'){

          double x = price * q;

          if(x>5){

              x = x - 0.1*x;

              System.out.println("There will be a 10% discount. Your new total is $"+x+". Thanks and have a nice day.");

          }

          else{

              System.out.println("Your total is $"+x+". Thanks and have a nice day");

          }

      }

      else if(c=='V' || c=='v'){

          double x = price * q;

          if(x>10){

              System.out.println("You have earned a free glass of leamonade. Your total is $"+x+". Thanks and have a nice day.");

          }

          else{

              System.out.println("Your total is $"+x+". Thanks and have a nice day");

          }

      }

  }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote