Created
November 14, 2013 07:17
-
-
Save pepet96/7462748 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
| class Delicatessen { | |
| public static void main (String [] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.println("Enter the item:"); | |
| String item = input.next(); | |
| System.out.println("Enter the price: "); | |
| double price = input.nextDouble(); | |
| System.out.println("Overnight delivery (1 stands for no, 2 stands for yes)."); | |
| int delivery = input.nextInt(); | |
| if (price < 10 && delivery == 1) System.out.println( item + price + "\nShipping: " + "2.00" + "\nTotal: " + (price + 2)); | |
| else if (price < 10 && delivery == 2) System.out.println( item + price + "\nShipping: " + "7.00" + "\nTotal: " + (price + 7)); | |
| else if (price > 10 && delivery == 1) System.out.println( item + price + "\nShipping: " + "3.00" + "\nTotal: " + (price + 3)); | |
| else System.out.println( item + price + "\nShipping: " + "8.00" + "\nTotal: " + (price + 8)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment