Created
October 8, 2013 17:09
-
-
Save imryan/6888000 to your computer and use it in GitHub Desktop.
Determine cost to make pizza.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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