R
rock_steady111
What I need to do is add an error dialog box if the gallons of water
excedes 990,000 gallons when entered but I'm not sure how or where to
put it
String input;
int GallonsUsed;
double WaterUsage;
double SewerUsage;
double BaseService;
double Subtotal;
double Tax;
double TotalDue;
BaseService = 15.79;
input = JOptionPane.showInputDialog("Enter the number of
gallons used during the billing period.");
GallonsUsed = Integer.parseInt(input); //Changing the string
into an integer
WaterUsage = ((GallonsUsed / 100) * .27);
SewerUsage = ((GallonsUsed / 1000) * 1.49);
Subtotal = BaseService + WaterUsage + SewerUsage;
Tax = Subtotal * .06;
TotalDue = Subtotal + Tax;
//JOptionPane.showMessageDialog(null, "Base Price $15.79");
System.out.printf("Base Service $%.2f%n", BaseService);
System.out.printf("Water Usage $%.2f%n", WaterUsage);
System.out.printf("Sewer Usage $%.2f%n", SewerUsage);
System.out.printf("Sub Total $%.2f%n", Subtotal);
System.out.printf("Tax $%.2f%n", Tax);
System.out.printf("Total Due $%.2f%n", TotalDue);
}
}
excedes 990,000 gallons when entered but I'm not sure how or where to
put it
String input;
int GallonsUsed;
double WaterUsage;
double SewerUsage;
double BaseService;
double Subtotal;
double Tax;
double TotalDue;
BaseService = 15.79;
input = JOptionPane.showInputDialog("Enter the number of
gallons used during the billing period.");
GallonsUsed = Integer.parseInt(input); //Changing the string
into an integer
WaterUsage = ((GallonsUsed / 100) * .27);
SewerUsage = ((GallonsUsed / 1000) * 1.49);
Subtotal = BaseService + WaterUsage + SewerUsage;
Tax = Subtotal * .06;
TotalDue = Subtotal + Tax;
//JOptionPane.showMessageDialog(null, "Base Price $15.79");
System.out.printf("Base Service $%.2f%n", BaseService);
System.out.printf("Water Usage $%.2f%n", WaterUsage);
System.out.printf("Sewer Usage $%.2f%n", SewerUsage);
System.out.printf("Sub Total $%.2f%n", Subtotal);
System.out.printf("Tax $%.2f%n", Tax);
System.out.printf("Total Due $%.2f%n", TotalDue);
}
}