I need help regarding with the computation of what the user order it seems that the options doesn't have a value to be computed please help me how to put values in every options and one more thing is i need help with the codes for the checkbox for additional order I'm not really good in programming and this is all the effort i can do. I really need to pass this project right now so i need a quick answer and by the way what is the problem with my display to user?
Help with: Checkbox codes,Computation,JOptionPane Display
package project2;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
public class Project2 {
public static void main(String[] args) {
List<String> optionList = new ArrayList<String>();
optionList.add("1");
optionList.add("2");
optionList.add("3");
optionList.add("4");
double charge;
double tax = 0.0675;
double tipRate = 0.15;
double totalWithTax;
double taxAmount;
double tipAmount;
double grandTotal;
//selection of food
Object[] options = optionList.toArray();
int value = JOptionPane.showOptionDialog(
null,
"Please select your Burger:(1 or 2)\n 1. Burger $3.00 \n 2. Cheese Burger $4.50 "
+ "\n 2. Bacon Burger $5.50 \n 2. Supreme Burger $7.00",
"Pick",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
optionList.get(0));
//calculate the charge and the tip
taxAmount = charge * tax;
totalWithTax = charge + taxAmount;
tipAmount = totalWithTax * tipRate;
grandTotal = totalWithTax + tipAmount;
//Display it back to the user
String opt = optionList.get(value);
JOptionPane.showMessageDialog(null,"You picked " + opt" \n meal: $" + charge" \n tax: $" + taxAmount" \n meal + tax: $" + totalWithTax" \n total cost(tip included): $" + grandTotal);
}
}