Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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) + "!"); } }

image text in transcribedimage text in transcribed

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 eggs

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

=+Have you acquired the ability to read,

Answered: 1 week ago