package week4; public class EggEx { /* * Using the table below on Modern egg sizes in Australia, get the input from the user (using Scanner class) and store the “Average egg weight” of an egg in a variable. Depending on egg weight output of the “Size” of the egg using the table below. Size Average Egg Weight King-Size Greater than 72 g Jumbo 68 – 72 g Extra-Large 60 – 67 g Large 52 – 59 g Medium 43 – 51 g Too Small Less than 43 g Input: Get the egg weight from user Process: if (egg weight > 72) then output “King-Size” else if (egg weight >= 68 and egg weight <= 72) then output “Jumbo” else if (egg weight >= 60 and egg weight <= 67) then output “Extra-Large” else if (egg weight >= 52 and egg weight <= 59) then output “Large” else if (egg weight >= 43 and egg weight <= 51) then output “Medium” else output “Too Small” Output: print the size of the egg */ public static void main(String[] args) { // Get the egg weight from user java.util.Scanner scanner = new java.util.Scanner(System.in); System.out.print("Enter the egg weight: "); int eggWeight = scanner.nextInt(); scanner.close(); // Process String size = ""; if (eggWeight > 72) { size = "King-Size"; } else if (eggWeight >= 68 && eggWeight <= 72) { size = "Jumbo"; } else if (eggWeight >= 60 && eggWeight <= 67) { size = "Extra-Large"; } else if (eggWeight >= 52 && eggWeight <= 59) { size = "Large"; } else if (eggWeight >= 43 && eggWeight <= 51) { size = "Medium"; } else { size = "Too Small"; } // Output System.out.println("Size of the egg: " + size); } }