Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions