I have a prewritten java program to calculate the total of monthly bills. It should execute until the user enters "done" instead of bill type. After the user enters a bill type, he should be asked to enter the bill amount. I don't have a clue where to start. The prewritten program is as follows....
// MonthlyBills.java - This program calculates the total of your monthly bills.
// Input: Bill type and bill amount.
// Output: Prints the total of your monthly bills.
import javax.swing.JOptionPane;
public class MonthlyBills
{
public static void main(String args[])
{
String billType; // Description of bill.
String stringAmount; // String version of bill amount.
double billAmount; // Amount of the bill.
double sum = 0; // Accumulates sum of bills.
/* You should set up your loop to execute as long as the user
has not entered the word done. You can use these input and
output statements anywhere in your program. They are not in
any particular order.
*/
// This input statement asks the user to enter a bill type or the word none.
billType = JOptionPane.showInputDialog("Enter bill type or the word done to quit.");
// This input statement asks your user to enter a bill amount.
stringAmount = JOptionPane.showInputDialog("Enter amount of bill");
// This statement converts the string version of the amount to a double.
billAmount = Double.parseDouble(stringAmount);
// This statement displays the sum of monthly bills.
System.out.println("Sum of monthly bills is $: " + sum);
// This statement causes the program to exit.
System.exit(0);
} // End of main() method.
} // End of MonthlyBills class.
Can anyone help complete this??
Thanks
Forum Rules
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center