Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MidtermLabExam_Tanginan {
- public static void main(String[] args) {
- //Variables
- int tan_NoWalk, tan_NoMotor, tan_NoCars, tan_NoExcessPassenger;
- double tan_TotalWalk = 0;
- char tan_excessPassenger = '\u0000';
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter the number of walk-in individuals: ");
- tan_NoWalk = sc.nextInt();
- System.out.println("Enter the number of motorcycles: ");
- tan_NoMotor = sc.nextInt();
- System.out.println("Excess passenger?: ");
- tan_excessPassenger = sc.next().charAt(0);
- tan_excessPassenger = Character.toUpperCase(tan_excessPassenger);
- if(tan_excessPassenger == 'Y') {
- System.out.println("Enter the number of excess passenger: ");
- tan_NoExcessPassenger = sc.nextInt();
- tan_TotalWalk = tan_NoWalk+tan_NoExcessPassenger;
- }
- System.out.print("Enter the number of cars: ");
- tan_NoCars = sc.nextInt();
- System.out.print("Excess passenger?: ");
- tan_excessPassenger = sc.next().charAt(0);
- tan_excessPassenger = Character.toUpperCase(tan_excessPassenger);
- if(tan_excessPassenger == 'Y') {
- System.out.print("Enter the number of excess passenger: ");
- tan_NoExcessPassenger = sc.nextInt();
- tan_TotalWalk += tan_NoExcessPassenger;
- }
- double tan_TotalIndividualFees = tan_TotalWalk*10;
- double tan_TotalMotorcyclesFees = tan_NoMotor*70;
- double tan_TotalCarsFees = tan_NoCars*200;
- double tan_TotalAmount = (tan_TotalWalk*10) + (tan_NoMotor*70) + (tan_NoCars*200);
- System.out.println("----------------------------------");
- System.out.println("Total Number of walk-in/Excess individuals: "+tan_TotalWalk);
- System.out.println("Total individual Fees: "+tan_TotalIndividualFees);
- System.out.println("Total Number of motorcycles: "+tan_NoMotor);
- System.out.println("Total Motorcycles Fees: "+tan_TotalMotorcyclesFees);
- System.out.println("Enter the number of cars: "+tan_NoCars);
- System.out.println("Total Cars Fees: "+tan_TotalCarsFees);
- System.out.println("Total Amount: "+tan_TotalAmount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement