I am so sorry to bother anyone on here for this but I cannot seem to figure out why my code isn't running. I have tried searching the internet as well as my textbook but I am obviously missing something that probably staring me right in the face. Again I apologize for the simplicity of this. Any help is appreciated.
import javax.swing.*;
/**
*
* @author Potato
*/
public class MannPass4
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// Declerations
double packageA, packageB;
double aPrice = 9.95, bPrice = 13.95, cPrice = 19.95;
double hoursA = 10, hoursB = 20, rHours, holdOption, holdHours;
final int A_ADDIT = 2, B_ADDIT = 1;
holdOption = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter the cuctomer's package (A, B, or C):"));
holdHours = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter the number of hours used:"));
if (holdOption == 'A')
{
rHours = (holdHours - hoursA);
packageA = ((rHours * A_ADDIT) + aPrice);
JOptionPane.showMessageDialog(null, "The charges are "+ packageA);
}
else if(holdOption == 'B')
{
rHours = (holdHours - hoursB);
packageB = ((rHours * B_ADDIT) + bPrice);
JOptionPane.showMessageDialog(null, "The charges are "+ packageB);
}
else if (holdOption == 'C')
{
JOptionPane.showMessageDialog(null, "The charges are "+ cPrice);
}
else
{
JOptionPane.showMessageDialog(null, "Invalid choice, please choose either A, B, or C.");
}
}
}
Aucun commentaire:
Enregistrer un commentaire