Advertisement
KeeganT

Ch5Ex3

Feb 14th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. package ch5ex3;
  2. import java.util.Scanner;
  3.  
  4. public class Ch5Ex3
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner sc=new Scanner(System.in);
  9.         System.out.print("Enter the number of eggs purchased: ");
  10.         int eggs=sc.nextInt();
  11.         if(eggs<4*12)
  12.         {
  13.             double price=eggs*0.5/12;
  14.             System.out.println("The bill is equal to: $"+price);
  15.         }
  16.         if(eggs<6*12&&eggs>=4*12)
  17.         {
  18.             double price=eggs*0.45/12;
  19.             System.out.println("The bill is equal to: $"+price);
  20.         }
  21.         if(eggs<11*12&&eggs>=6*12)
  22.         {
  23.             double price=eggs*0.4/12;
  24.             System.out.println("The bill is equal to: $"+price);
  25.         }
  26.         if(eggs>=11*12)
  27.         {
  28.             double price=eggs*0.40/12;
  29.             System.out.println("The bill is equal to: $"+price);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement