Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created November 14, 2013 07:17
Show Gist options
  • Save pepet96/7462748 to your computer and use it in GitHub Desktop.
Save pepet96/7462748 to your computer and use it in GitHub Desktop.
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