pizza

Run Settings
LanguageJava
Language Version
Run Command
import java.text.*; import java.util.Scanner; class Main { public static void main(String[] args) { //variables Scanner s = new Scanner(System.in); DecimalFormat DF = new DecimalFormat("$###.##"); double labourCost = 1.00; double storeCost = 1.50; int small = 6; int medium = 8; int large = 10; int xlarge = 12; String userInput; //input1 userInput = s.nextLine(); int inputNOP = Integer.parseInt(userInput); System.out.println("Number of pizzas: " + inputNOP); //calculation 1 double pizzaCount = inputNOP * labourCost + inputNOP * storeCost; //input2 userInput = s.nextLine(); int inputSize = Integer.parseInt(userInput); //if else if (inputSize == 6){ System.out.println("Size chosen: Small "); } else if (inputSize == 8){ System.out.println("Size chosen: Medium "); } else if (inputSize == 10){ System.out.println("Size chosen: Large "); } else if (inputSize == 12){ System.out.println("Size chosen: XLarge "); } else{ System.out.println("eek ook"); } //calculation 2 double materialCost = 1.50 * inputSize * inputNOP; System.out.println("Labour cost: " + DF.format(labourCost)); System.out.println("Store cost: " + DF.format(storeCost)); System.out.println("Material cost: " + DF.format(materialCost)); //calculation 3 double totalCost = materialCost + pizzaCount; System.out.println("\nTotal cost: " + DF.format(totalCost)); } }
Editor Settings
Theme
Key bindings
Full width
Lines