package internetserviceprovider;
import javax.swing.JOptionPane;
/**
*
* @author Home
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
char packageLetter;
int hoursUsed;
int additionalHours = 0;
double monthlyFee = 0;
double additionalHoursFee;
double totalFee;
String inputString;
inputString = JOptionPane.showInputDialog("Enter the letter of the " +
"package you purchased (either A, B, or C.)");
inputString = inputString.toUpperCase();
packageLetter = inputString.charAt(0);
inputString = JOptionPane.showInputDialog("Enter the number of hours " +
"you used.");
hoursUsed = Integer.parseInt(inputString);
{
if (packageLetter=='A'&& additionalHours > 0 && hoursUsed > 10)
{
monthlyFee = 9.95;
additionalHours = hoursUsed - 10;
additionalHoursFee = additionalHours * 2.00;
totalFee = monthlyFee + additionalHoursFee;
JOptionPane.showMessageDialog(null,"The total charges is $" +
totalFee + ".");
}
if(packageLetter=='B' && additionalHours>0 && hoursUsed>20)
{
monthlyFee = 13.95;
additionalHours = hoursUsed - 20;
additionalHoursFee = additionalHours * 1.00;
totalFee = monthlyFee + additionalHoursFee;
JOptionPane.showMessageDialog(null,"The total charges is $" +
totalFee + ".");
}
if(packageLetter=='C')
{
totalFee = 19.95;
JOptionPane.showMessageDialog(null,"The total charges is $" +
totalFee + ".");
}
else
JOptionPane.showMessageDialog(null,"Please enter either A,B, " +
"or C).");
}
System.exit(0);
}
}