|
-
February 15th, 2010, 07:04 PM
#1
Basic Java Programming Question
I am trying to fix my java application to compile. I am not sure if I made a logical error or what but would really appreciate it if someone could help me out!
*/
import javax.swing.JOptionPane;
public class RentalDialog {
double TAX = 0.05;
double bookCOST = 1.50;
double movieCOST = 2.00;
double CDCOST = 1.00;
public static void main(String[] args) {
double taxAmount, subtotal, total;
int numDays;
int RentalType = Integer.parseInt(JOptionPane.showInputDialog(null, "Which item would you like to rent?:\n1. Book\n2. Movie\n3. CD"));
double RentalFee = 0;
switch (RentalType) {
case 1 : {
numDays=Integer.parseInt(JOptionPane.showInputDialog("How many days did you want to rent the book at "+bookCOST+ " each:"));
subtotal = numDays*bookCOST;
taxAmount = subtotal * TAX ;
total = subtotal + taxAmount;
}
}
case 2 : {
numDays=Integer.parseInt(JOptionPane.showInputDialog("How many days did you want to rent the movie at "+movieCOST+ " each:"));
subtotal = numDays*movieCOST;
taxAmount = subtotal * TAX ;
total = subtotal + taxAmount;
}
}
case 3 : {
numDays=Integer.parseInt(JOptionPane.showInputDialog("How many days did you want to rent the DVD at "+DVDCOST+ " each:"));
subtotal = numDays*DVDCOST;
taxAmount = subtotal * TAX ;
total = subtotal + taxAmount;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|