Question: Create 4 flow chart one for each process/class. import java.util.Scanner; // First class SingleBurgerCost - without tip public class SingleBurgerCost { public static void main(String[]

Create 4 flow chart one for each process/class.

import java.util.Scanner;

// First class SingleBurgerCost - without tip

public class SingleBurgerCost {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println("What type of burger would you like (Vegan or Beef)?: ");

String name = input.next();

if(name.equalsIgnoreCase("Vegan"))

{

Vegan burger = new Vegan();

System.out.println("You have ordered: ");

System.out.println(burger);

}

else if(name.equalsIgnoreCase("Beef"))

{

Burger burger = new Burger();

System.out.println("What type of bread would you like (White or Wheat)?: ");

String bread = input.next();

burger.setBread(bread);

System.out.println("What type of drink would you like (Water or Soda)?: ");

String drink = input.next();

burger.setDrink(drink);

System.out.println("You have ordered: ");

System.out.println(burger);

}

}

}

// Second class Burger

class Burger {

private String type;

private double cost;

private String burger;

private String bread;

private String drink;

public Burger()

{

this.type = "Beef";

this.cost = 6.99; // cost for both vegan and beef burgers

}

public Burger(String type, double cost)

{

this.type = type;

this.cost = cost;

}

public double getCost()

{

return cost;

}

public void setCost()

{

this.cost += 1;

}

public String getType()

{

return type;

}

public void setType(String type)

{

this.type = type;

}

public String getBread()

{

return bread;

}

public String getDrink()

{

return drink;

}

public void setBread(String bread)

{

this.bread = bread;

}

public void setDrink(String drink)

{

this.drink = drink;

setCost();

}

@Override

public String toString()

{

return getType() + " burger "

+ this.getBread() + " bread" + " "

+ this.getDrink() + "(+ $0.99) " // additional cost for a drink if a beef burger is ordered

+ "A burger cost is $"+ this.getCost();

}

}

// Third class Vegan

class Vegan extends Burger

{

public Vegan()

{

this.setType("Vegan");

setBread();

}

public void setBread()

{

// a vegan burger order comes with wheat bread and a drink

this.setBread("with " + "wheat bread " + "and " + "complimentary drink");

}

@Override

public String toString()

{

return getType() + " burger "+ this.getBread() + " "+ "A burger cost is $"+ this.getCost();

}

}

=================================
import java.util.Scanner;
public class TotalOrderCost {
private static final int VEGAN_COST = 7;
private static final int BEEF_COST = 8;
private static final double TIP_COST = 0.10;
private static int getBurger(String bought, Scanner in) {
int num = -1;
System.out.print(bought);
num = in.nextInt();
// Clear keyboard buffer
in.nextLine();
// Check if num is negative
if (num < 0) {
System.out.println("ERROR!"); // Number of burgers can not be negative
getBurger(bought, in);
}
return num;
}
private static int getTotal(int noOfVegan, int noOfBeef) {
return (noOfVegan * VEGAN_COST) + (noOfBeef * BEEF_COST);
}
private static double getTipCost(int total) {
return total * TIP_COST;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!