/**
*
*/
package version1;
import javax.swing.JOptionPane;
/**
* @author Gardy
*
*/
public class InternetApp {
static double packages;
static double pack1 = 9.95 ;
static double pack2 = 13.95;
static double pack3 = 19.95 ;
static String input;
static double hours;
static double monthlyfee;
static double regularHours1 = 10;
static double regularHours2 = 20;
static double additionalHoursFee;
static double additionalhours;
static double total;
static double total2;
static double total3;
public static void main(String[] args) {
doPackages();
}
private static void doPackages() {
input = JOptionPane.showInputDialog("What is your internet service ID (A, B or C)");
if(input == null || input.isEmpty()){}
// Package 1
if(input.toUpperCase().charAt(0) == 'A');{
getPackage();}
//Package 2
if(input.toUpperCase().charAt(0) == 'B'){
getPackage2();}
//Package 3
if(input.toUpperCase().charAt(0) == 'C');{
getPackage3();}
}
private static void getPackage3() {
total3 = pack3;
JOptionPane.showMessageDialog(null, "The total charges are: $" + total3);
}
private static void getPackage2() {
input = JOptionPane.showInputDialog("How many hours have you used");
hours = Double.parseDouble(input);
if(hours <= 20){
total2 = pack2;
}
else {
additionalhours = hours - regularHours2;
additionalHoursFee = additionalhours * 1.00;
total2 = pack2 + additionalHoursFee;
}
JOptionPane.showMessageDialog(null, "The total charges are: $" + total2);
}
private static void getPackage() {
// input = JOptionPane.showInputDialog("How many hours have you used");
//
// hours = Double.parseDouble(input);
//
// if(hours <= 10){
//
// total = pack1;
// }
//
// else {
//
// additionalhours = hours - regularHours1;
// additionalHoursFee = additionalhours * 2.00;
// total = pack1 + additionalHoursFee;
// }
//
// JOptionPane.showMessageDialog(null, "The total charges are: $" + total);
//
}
}