Previous Next
0 / 15
Module DEMO-33-69DEMO-OOP-33

Bus Trip Ticketing

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create two Java files: Main.java and BusTrip.java.

Read the required values, construct a BusTrip object, and print a multiline report.

The report must contain these lines in this order:

  1. Route
  2. Remaining Seats
  3. Revenue

Use a constructor and keep the object-oriented structure clear.

Input Format

Input is provided as separate whitespace-separated tokens in the same order described in the problem statement.

Output Format

Print the exact multiline report required by the question.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
R1
40
25
1.25
Route: R1
Remaining Seats: 15
Revenue: 31.25
Input: route code = "R1", seat count = 40, booked seats = 25, fare = 1.25.
Key calculation(s): "Route: " + "R1" = "Route: R1" | "Remaining Seats: " + 40 - 25 = "Remaining Seats: 15".
Output:
Route: R1
Remaining Seats: 15
Revenue: 31.25
Sample #2
Public sample
R2
30
30
0.75
Route: R2
Remaining Seats: 0
Revenue: 22.50
Input: route code = "R2", seat count = 30, booked seats = 30, fare = 0.75.
Key calculation(s): "Route: " + "R2" = "Route: R2" | "Remaining Seats: " + 30 - 30 = "Remaining Seats: 0".
Output:
Route: R2
Remaining Seats: 0
Revenue: 22.50

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings