Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BusTest {
- public static void main(String[] args) {
- Bus b1, b2, b3;
- //b1 = new Bus();
- //b2 = new Bus();
- b3 = new Bus("Dhaka Chaka", 30, 6000, "Gazipur", "Mirpur");
- /*b1.name = "Bolaka";
- b1.seatCount = 25;
- b1.engineCapacity = 3000;
- b1.source = "Gazipur";
- b1.destination = "Jatrabari";
- b2.name = "Projapoti";
- b2.seatCount = 35;
- b2.engineCapacity = 3200;
- b2.source = "Tongi";
- b2.destination = "Shyamoli";
- System.out.println("Bus 1:");
- System.out.println("Name: " + b1.name);
- System.out.println("Seat Count: " + b1.seatCount);
- System.out.println("Engine Capacity: " + b1.engineCapacity);
- System.out.println("Source: " + b1.source);
- System.out.println("Destination: " + b1.destination);*/
- System.out.println("\nBus 2:");
- System.out.println("Name: " + b3.name);
- System.out.println("Seat Count: " + b3.seatCount);
- System.out.println("Engine Capacity: " + b3.engineCapacity);
- System.out.println("Source: " + b3.source);
- System.out.println("Destination: " + b3.destination);
- }
- }
- public class Bus
- {
- {
- String name;
- int seatCount;
- int engineCapacity;
- String source;
- String destination;
- }
- public Bus()
- {
- }
- public Bus(String name, int seatCount, int engineCapacity, String source, String destination)
- {
- this.name = name;
- this.seatCount = seatCount;
- this.engineCapacity = engineCapacity;
- this.source = source;
- this.destination = destination;
- }
- @Override
- public String toString()
- {
- return "Name: " +this.name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement