Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. // HANZ AUGUSTINE S. BERMEJO BSIT 1-D\\
  2. package javaapplication1;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class JavaApplication1 {
  7.  
  8. public static void main(String[] args) {
  9.  
  10. String name,hanz;
  11. int ticket, seat, rebookingfee, meal;
  12. double insurance, baggagew, totalAmount, Subtotal, baggagefee, Tax;
  13. final double iTax = 0.12;
  14.  
  15. Scanner inp = new Scanner (System.in);
  16.  
  17. System.out.println("Customer's Name: ");
  18. name = inp.nextLine();
  19. System.out.println("Price of ticket: ");
  20. ticket = inp.nextInt();
  21. System.out.println("Meal: ");
  22. meal = inp.nextInt();
  23. System.out.println("Insurance: ");
  24. insurance = inp.nextDouble();
  25. System.out.println("Seat#: ");
  26. seat = inp.nextInt();
  27. System.out.println("Rebooking Fee: ");
  28. rebookingfee = inp.nextInt();
  29. System.out.println("Weight of Baggage: ");
  30. baggagew = inp.nextDouble();
  31.  
  32.  
  33. if (baggagew >=20 && baggagew <=31){
  34. baggagefee = 700;
  35. }
  36. else if (baggagew >=32 && baggagew <=39 ) {
  37. baggagefee = 1350;
  38. }
  39. else if (baggagew>=40 && baggagew <=69){
  40. baggagefee = 1900;
  41. }
  42. else if (baggagew >=70 && baggagew <=90){
  43. baggagefee = 2500;
  44. }
  45. else {
  46. baggagefee = 2500;
  47.  
  48. }
  49.  
  50.  
  51.  
  52.  
  53. Subtotal = (ticket + meal + rebookingfee + baggagefee + insurance);
  54. System.out.println("Subtotal:" + Subtotal);
  55.  
  56.  
  57.  
  58. Tax = (Subtotal * iTax);
  59. System.out.println("Tax: " + iTax);
  60.  
  61. totalAmount = (Subtotal + Tax);
  62. System.out.println("Total Ammount:" + totalAmount);
  63.  
  64. System.exit(0);
  65.  
  66.  
  67.  
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement