Question
Need to edit my code import java.util.Scanner; public class Eggs { public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.print(Enter number of
Need to edit my code
import java.util.Scanner;
public class Eggs { public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.print("Enter number of Eggs : "); int totalEggs = scan.nextInt();
int extra = totalEggs % 12; double ecost = (double) extra * 45 / 100; double cost = totalEggs / 12 * 3.25 + ecost; System.out.println(" You ordered " + totalEggs + " eggs."); System.out.println("That's " + totalEggs / 12 + " dozen at $3.25 per dozen and " + extra + " loose eggs at 45 cents each for a total of $" + cost + ". With the special promotion, you pay $" + (int)(cost) + "!"); } }
Latest submission - 12:20 PM on 09/22/17 Total score: 0 / 10 1: Compare output a 0/3 Input 27 Enter number of Eggs : You ordered 27 eggs Your output That's 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for With the special promotion , you pay $7! Expected output You ordered 27 eggs . That's 2 dozen at $3.25 per dozen and 3 loose eggs 2: Compare output a 0/3 Input 41 Enter number of Eggs You ordered 41 eggs . Your output That's 3 dozen at $3.25 per dozen and 5 loose eggs at 45 cents each for | With the special promotion, you pay $12 ! Expected output You ordered 41 eggs. That's 3 dozen at $3.25 per dozen and 5 loose eggsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started