Loading...
Convert the following if else if construct into switch case: if (ch== 'c' || ch=='C') System.out . print("COMPUTER"); else if (ch== 'h' || ch=='H') System.out . print("HINDI"); else System.out . print("PHYSICAL EDUCATION");
A private Cab service company provides service within the city at the following rates: | AC CAR | NON AC CAR UPTO 5 KM | ₹ 150 /- | ₹ 120 /- BEYOND 5 KM | ₹ 10/-PER KM | ₹ 08/- PER KM Design a class CabService with the following description: Member variables /data members: String car_type - To store the type of car (AC or NON AC) double km - To store the kilometer travelled double bill - To calculate and store the bill amount Member methods : CabService() - Default constructor to initialize data members. String data members to " " and double data members to 0.0. void accept () - To accept car_type and km (using Scanner class only). void calculate () - To calculate the bill as per the rules given above. void display() - To display the bill as per the following format CAR TYPE: KILOMETER TRAVELLED: TOTAL BILL: Create an object of the class in the main method and invoke the member methods.
© 2026 PadhAiPro. This question is provided for educational purposes.