Advertisement
Kulas_Code20

Barge Transportation

Oct 21st, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MidtermLabExam_Tanginan {
  4.  
  5.     public static void main(String[] args) {
  6.         //Variables
  7.         int tan_NoWalk, tan_NoMotor, tan_NoCars, tan_NoExcessPassenger;
  8.         double tan_TotalWalk = 0;
  9.         char tan_excessPassenger = '\u0000';
  10.        
  11.         Scanner sc = new Scanner(System.in);
  12.        
  13.        
  14.         System.out.println("Enter the number of walk-in individuals: ");
  15.         tan_NoWalk = sc.nextInt();
  16.         System.out.println("Enter the number of motorcycles: ");
  17.         tan_NoMotor = sc.nextInt();
  18.         System.out.println("Excess passenger?: ");
  19.         tan_excessPassenger = sc.next().charAt(0);
  20.         tan_excessPassenger = Character.toUpperCase(tan_excessPassenger);
  21.         if(tan_excessPassenger == 'Y') {
  22.             System.out.println("Enter the number of excess passenger: ");
  23.             tan_NoExcessPassenger = sc.nextInt();
  24.             tan_TotalWalk = tan_NoWalk+tan_NoExcessPassenger;
  25.         }
  26.         System.out.print("Enter the number of cars: ");
  27.         tan_NoCars = sc.nextInt();
  28.         System.out.print("Excess passenger?: ");
  29.         tan_excessPassenger = sc.next().charAt(0);
  30.         tan_excessPassenger = Character.toUpperCase(tan_excessPassenger);
  31.         if(tan_excessPassenger == 'Y') {
  32.             System.out.print("Enter the number of excess passenger: ");
  33.             tan_NoExcessPassenger = sc.nextInt();
  34.             tan_TotalWalk += tan_NoExcessPassenger;
  35.         }
  36.         double tan_TotalIndividualFees = tan_TotalWalk*10;
  37.         double tan_TotalMotorcyclesFees = tan_NoMotor*70;
  38.         double tan_TotalCarsFees = tan_NoCars*200;
  39.         double tan_TotalAmount = (tan_TotalWalk*10) + (tan_NoMotor*70) + (tan_NoCars*200);
  40.        
  41.         System.out.println("----------------------------------");
  42.         System.out.println("Total Number of walk-in/Excess individuals: "+tan_TotalWalk);
  43.         System.out.println("Total individual Fees: "+tan_TotalIndividualFees);
  44.         System.out.println("Total Number of motorcycles: "+tan_NoMotor);
  45.         System.out.println("Total Motorcycles Fees: "+tan_TotalMotorcyclesFees);
  46.         System.out.println("Enter the number of cars: "+tan_NoCars);
  47.         System.out.println("Total Cars Fees: "+tan_TotalCarsFees);
  48.         System.out.println("Total Amount: "+tan_TotalAmount);
  49.        
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement