I am building this program:
A farm that sells eggs to customers charges $3.25 for a dozen eggs, or 45 cents for individual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs and then displays the amount owed with a full explanation.
I am experiencing problems with making the program aware of what is and isn't a dozen and how to calculate what is left after subtracting the dozen. So far, this is what I have:
import javax.swing.JOptionPane;
public class Eggs
{
public static void main(String[] args)
{
String orderString;
final double DOZEN = 3.25;
final int INDIVIDUAL = 45;
int order;
orderString = JOptionPane.showInputDialog(null, "How many eggs do you want?", "Order dialog", JOptionPane.INFORMATION_MESSAGE);
boolean isDozen = (orderstring >= 12);
order = Double.parseDouble(orderString) * DOZEN;
String.out.print("You ordered " + orderString + " eggs.");
}
}
Before including the boolean variable I was not getting errors, but after that I was. I thought I was to use it to create a conditional statement, But I am confused now.
Thank you for assisting.