Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 $7Step 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