I am now taking Java classes and I have worked this program out, but it is giving me a "illegal start of type" on my code and I do not know why please help. Thanks for your help.
// Displaying multiple strings
import javax.swing.*; // to use JOptionPane.show InputDialog box
public class a3
{
public static void main( String args[] )
{
final double taxes = 0.0795; // rate for taxes calculation (constant)
int
moreInt = 1; // loop control variable
double
totalPrice = 0, // the sum of calculated devices
devices = 0, // the number of devices wanted
salesTax = 0, // the calculated sales tax
cost = 0, // fixed cost on the amount of devices sold
totalAmount = 0; // the total amount for devices
String numberDevices; // number of devices
// process unknown number of devices, boolean controled loop
while ( moreInt == 1 ) {
numberDevices = JOptionPane.showInputDialog(
"Enter the number of SuperX Devices" );
// convert numbers from type String to type double
devices = Double.parseDouble( numberDevices );
This is where I am getting the "illegal start of type:
// to determine the cost on the devices
if( devices < 30 )
cost = "46.00";
else if( devices >= 30 && < 70 )
cost = "43.00";
else if( devices > 70)
cost = "40.00";
// calculations
totalAmount = devices * cost;
salesTax = totalAmount * taxes;
totalPrice = totalAmount + salesTax;
// display message total
JOptionPane.showMessageDialog( null, "The number of Devices" + devices, "@" + cost, "ea" +totalAmount, "Sales taxes @ 7.95%" + taxes, "Total Price" + totalPrice, output);
// display the "Thank you" message
if (totalPrice < 1000)
output ="Thank you - We hope to see you again!";
else if (totalPrice > 1000)
output = "Thank you - Call us if you need help installing the SuperX Devices.";
input = JOptionPane.showInputDialog(
"Another order?\n 1 - yes\n 2 - no\n" );
moreInt = Integer.parseInt( input );
} //while loop ends
} // end method main
} // end method a3