Warning yan na nagdefine ka ng variable na hindi mo ginamit sa program mo.
I need help po. Here's the code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication7;
import java.util.Scanner;
/**
*
* @author Allen
*/
public class JavaApplication7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String customername;
Double ticketprice, meal, insurance, seat, rebookingfee, weight, baggage, tax, subtotal, grandtotal;
Scanner in = new Scanner (System.in);
System.out.println("Customer Name: ");
customername = in.nextLine();
System.out.println("Ticket Price: ");
ticketprice = in.nextDouble();
System.out.println("Meal: ");
meal = in.nextDouble();
System.out.println("Insurance: ");
insurance = in.nextDouble();
System.out.println("Seat: ");
seat = in.nextDouble();
System.out.println("Rebooking Fee: ");
rebookingfee = in.nextDouble();
System.out.println("Baggage Weight(kg): ");
weight = in.nextDouble();
if (weight <=20){
baggage = 700.0;
}else if (weight <=32){
baggage = 1350.0;
}else if (weight <=40){
baggage = 1900.0;
}else if (weight <=70){
baggage = 2500.0;
}else{
System.out.println("Error");
tax = 0.12;
subtotal = ticketprice + meal + insurance + seat + rebookingfee + baggage;
grandtotal = (subtotal * tax) + subtotal;
System.out.println("Customer Name: " + customername);
System.out.println("Ticket Price: " + ticketprice);
System.out.println("Meal: " + meal);
System.out.println("Insurance: " + insurance);
System.out.println("Seat: " + seat);
System.out.println("Rebooking Fee: " + rebookingfee);
System.out.println("Subtotal: " + subtotal);
System.out.println("Grand Total: " + grandtotal);
}
}
}