Originally Posted by
Norm
"reached end of file while parsing."
Check for matching pairs of {}s
Make sure they are all paired.
The brackets seem to pair up nicely...
The last bracket, isn't it supposed to pair up with the one after "public static void"?
package javaapplication11;
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 + ".");
}
else 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 + ".");
}
else if(packageLetter=='C')
{
totalFee = 19.95;
JOptionPane.showMessageDialog(null,"The total charges is $" +
totalFee + ".");
}
if(packageLetter!='A' && packageLetter!='B' && packageLetter!='C')
{
JOptionPane.showMessageDialog(null, "Please enter either A,B, "
+ "or C).");
}
System.exit(0);
}
}