Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jake Robbins
- import java.util.Scanner ;
- class ch5ex1
- {
- public static void main (String[] args)
- {
- double price, overnight, shipping;
- String item;
- System.out.println("Enter the item: ");
- item = Scan.nextLine();
- System.out.println("Enter the price: ");
- price = Scan.nextDouble();
- System.out.println("Overnight delivery (1 = yes, 2 = no): ");
- overnight = Scan.nextDouble();
- if ( price > 10 )
- {
- shipping = price + 3;
- }
- else ( price < 10 )
- {
- shipping = price + 2;
- }
- if ( overnight == 1 && price > 10 )
- {
- shipping = price + 8;
- }
- else if ( overnight == 1 && price < 10 )
- {
- shipping = price + 7;
- }
- else if ( overnight == 2 && price > 10 )
- {
- shipping = price + 8;
- }
- else ( overnight == 2 && price < 10 )
- {
- shipping = price + 7;
- }
- System.out.println(" Your total will be: " + shipping );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement