Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help editing my code public class Eggs{ { public static void main(String

ID: 3888730 • Letter: I

Question

I need help editing my code

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.0 cents each for a total of $"+cost+".");

}

}

Programming task The class will be called Eggs java. Meadowdale Dairy Farm sells organic brown eggs to local customers. They charge: -$3.25 for a dozen eggs-45 cents for individual eggs (not part of a dozen) As a special re-opening promotion, Meadowdale Dairy Farm will floor the price of the eggs (only charge the whole dollar amount) Write a class that accepts only one input from the user: for the number of eggs in the customer's order. After this, display the amount owed with a full explanation. Use arithmetic operations to calculate the correct dozens/loose eggs and total cost. For example, typical output might be: You ordered 27 eggs. That's 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents per each for a total of $7.85. With the special promotion, you pay $7!

Explanation / Answer

Eggs.java

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

_______________________

Output:

Enter number of Eggs : 27

You ordered 27 eggs.
That's 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85.
With the special promotion, you pay $7!

_____________Could you rate me well.Plz .Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote