Help me with my program please!!
Here are the requirements:
(1) The weekly fee for mowing a lot under 400 square feet is $25 per week. The fee for a lot between 400 and 600 square feet is $35 per week. For lots over 600 square feet you will charge $50 per week. Display fees in a dialog box and prompt the user for the length and width of the lot to be mowed (prompt again if either is not positive). Display the resulting seasonal fee for the lot size.
(2) You decide to give customers a discount if they pay up front. Give the option to pay once, twice, or twenty times a season. If they pay once, they get 10% off, if they pay twice, they get 5% off, and if they pay 20 times (weekly), there is no discount. Provide the details, prompt the user for a plan, and then display an invoice with all the information.
Code:
import javax.swing.*;
public class Methods
{
final double MOWING_SEASON = 20;
final double ONCE_DISCOUNT = .1;
final double TWICE_DISCOUNT = .05;
public static void main (String [] args)
{
fee();
double Length = getLength();
double Width = getWidth();
double LotPrice = calcPrice(Length, Width);
double Percent = PercentDiscount();
output(LotPrice, PercentDiscount);
}
public static void fee()
{
JOptionPane.showMessageDialog(null, "Prices for different lot sizes:\n"
+ "Lot < 400 Sq Ft: Cost $25 per week\n"
+ "Lot between 400 and 600 Sq Ft: Cost $35 per week\n"
+ "Lot > 600 Sq Ft: Cost $50 per week");
}
public static double getLength()
{
double length;
do{
length = Double.parseDouble(JOptionPane.showInputDialog("Please enter the length for your lot: "));
}while(length < 0);
return length;
}
public static double getWidth()
{
double width;
do{
width = Double.parseDouble(JOptionPane.showInputDialog("Please enter the width for your lot: "));
}while(width < 0);
return width;
}
public static double calcPrice(double Length, double Width)
{
double size = Length * Width;
String lotsize = "";
if (size < 400)
lotsize = "$25 per week";
else
if (size > 400 || size <600)
lotsize = "$35 per week";
else
if (size > 600)
lotsize = "$50 per week";
return lotsize;
}
public static double PercentDiscount()
{
// pay once = 10% off
// pay twice = 5% off
// pay >= 3 time than no discount
}
public static void output()
{
JOptionPane.showMessageDialog(null, "");
}
}
I basically need help on requirement 2. How do I prompt the user if they want to pay upfront once, twice, etc?
Any help would be great!
Josh