Advertisement
ralphdc09

itf106.pr.wk02.number05

Jul 30th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package pr.wk02;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class number05 {
  6.     public static void main(String[] args) {
  7.         int eggs;
  8.         int gross;
  9.         int extraGross;
  10.         int dozens;
  11.         int extras;
  12.  
  13.         Scanner rdc = new Scanner(System.in);
  14.         System.out.print("How many eggs do you have?  ");
  15.         eggs = rdc.nextInt();
  16.  
  17.         gross = eggs / 144;
  18.         extraGross = eggs % 144;
  19.  
  20.         dozens = extraGross / 12;
  21.         extras = extraGross % 12;
  22.  
  23.         System.out.print("Your number of eggs is ");
  24.         System.out.print(gross + " gross ");
  25.         System.out.print(dozens + " dozen ");
  26.         System.out.print("and " + extras);
  27.         System.out.println();
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement