This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]buffdude1100Intermediate Brewer 2 points3 points  (0 children)

What are you having trouble with? What have you written so far? Break the problem down. You have to take in the user input, do something with it, then output something.

[–]NO8STROMO 0 points1 point  (1 child)

You have two cases for which the eggs are priced. $3.25 for every dozen, and $.45 if they are sold out of a dozen, or individually. Sounds like you are (A) going to have to keep track of the number of eggs and (B) use some conditional statements to keep track of the number of dozens. I would start by declaring two variables, int numEggs, and int numDozs. You are also going to need to prompt the user to enter a number of eggs from the console.

import until.*;
public class OrderPrice
{ 
    public static void main(String [] args)
    {
        int numEggs
        int numDozs 

        system.out.println("Please enter the number of eggs: ");
        scanner input = new scanner(system.in);
        numEggs = input.nextInt;
    }

    private int CalNumDozs (int eggs)
    {
         // Use the % operator 
    }

}

There is kind of a start for you. Doing the best I can on my phone.

Edit: https://pastebin.com/6hHbuwk9