I need help with my Java homework!

Write a program that calculates a customer's monthly bill. It should ask the user via dialog box to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. It should then display the charges in a dialog box. The input and out put must be done using the dialog boxes.

Modify the program so it calculates and displays the amount of money Packaage A customers would save if they purchased Packages B or C, and the amount of money Package B customers would save if they purchased Package C. If there would be no savings, no message should be printed.

Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour.

Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour.

Package C: For $19.95 per month unlimited acess is provided.

Here's some Java code that'll do the trick:

(copy+paste it into your address bar and remove the space)
pastebin. com/A1MZvUyJ

OH My Gosh I Love you!

Thanks Helpful Dude

No problem! I'm just so happy that this question falls under an area that I am so proficient in!

To solve this problem, you can follow these steps:

1. Start by importing the necessary classes:
```java
import javax.swing.JOptionPane;
```

2. Prompt the user to enter the package letter and number of hours used:
```java
String packageLetter = JOptionPane.showInputDialog("Enter the package letter (A, B, or C):");
int hoursUsed = Integer.parseInt(JOptionPane.showInputDialog("Enter the number of hours used:"));
```

3. Calculate the charges based on the user's input:
```java
double charges = 0.0;

if (packageLetter.equals("A")) {
charges = 9.95;
if (hoursUsed > 10) {
charges += (hoursUsed - 10) * 2.0;
}
} else if (packageLetter.equals("B")) {
charges = 13.95;
if (hoursUsed > 20) {
charges += (hoursUsed - 20) * 1.0;
}
} else if (packageLetter.equals("C")) {
charges = 19.95;
}
```

4. Display the charges in a dialog box:
```java
JOptionPane.showMessageDialog(null, "The monthly charges are: $" + charges);
```

5. To calculate and display the potential savings for Package A and Package B customers, you can add the following code after step 4:
```java
if (packageLetter.equals("A")) {
double savingsB = ((20 - hoursUsed) * 1.0) - (charges - 13.95);
double savingsC = (charges - 19.95);

if (savingsB > 0) {
JOptionPane.showMessageDialog(null, "Package A customers could save $" + savingsB + " by upgrading to Package B.");
}

if (savingsC > 0) {
JOptionPane.showMessageDialog(null, "Package A customers could save $" + savingsC + " by upgrading to Package C.");
}
} else if (packageLetter.equals("B")) {
double savingsC = (charges - 19.95);

if (savingsC > 0) {
JOptionPane.showMessageDialog(null, "Package B customers could save $" + savingsC + " by upgrading to Package C.");
}
}
```

That's it! You have now implemented a Java program to calculate the customer's monthly bill, display the charges, and calculate potential savings for Package A and Package B customers.