Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch5ex3;
- import java.util.Scanner;
- public class Ch5Ex3
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- System.out.print("Enter the number of eggs purchased: ");
- int eggs=sc.nextInt();
- if(eggs<4*12)
- {
- double price=eggs*0.5/12;
- System.out.println("The bill is equal to: $"+price);
- }
- if(eggs<6*12&&eggs>=4*12)
- {
- double price=eggs*0.45/12;
- System.out.println("The bill is equal to: $"+price);
- }
- if(eggs<11*12&&eggs>=6*12)
- {
- double price=eggs*0.4/12;
- System.out.println("The bill is equal to: $"+price);
- }
- if(eggs>=11*12)
- {
- double price=eggs*0.40/12;
- System.out.println("The bill is equal to: $"+price);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement