Skip to content

Instantly share code, notes, and snippets.

@imryan
Created October 8, 2013 17:09
Show Gist options
  • Save imryan/6888000 to your computer and use it in GitHub Desktop.
Save imryan/6888000 to your computer and use it in GitHub Desktop.
Determine cost to make pizza.
import java.util.Scanner;
public class PizzaCost {
public static void main(String[] args) {
// Declare variables
Scanner sc = new Scanner(System.in);
double size = 0.0;
double cost = 0.0;
// Display instructions
System.out.println("\nEnter the size of the pizza(diameter): ");
size = sc.nextDouble();
// Calculate total cost
cost = ((.05 * size * size) + 1 + .75);
// Output the total
System.out.println("Total cost: $" + cost);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment