Aim/Overview of The Practical:: To Write Programs For The Questions Given Below

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1.

Aim/Overview of the practical:


To write programs for the questions given below.

2. Task to be done: Worksheet Questions:


Create a class Vehicle having a child class Bike, Another class MTB is inheriting he class Bike. Create different
method like bikespeed, numberofgear, seatheight etc. in class MTB add features of MTB, in bike class add
feature of bike, and in vehicle class add common feature of both. Create object of MTB and call all methods and
display the output.

2. Code for experiment/practical:

Code for 1st Question:

class vehicle { public void type()

System.out.println("select your vehicle type ");

System.out.println("1.Bike "+'\n'+"2. car"+'\n');

class Bike extends vehicle { public void Bikespeed()

System.out.println("Max Speed of bike 310 k/m");

public void noofgear()

System.out.println("Max Gear a Bike have is 6");

}
}

class Mtb extends Bike { public void defination()

System.out.println(" Mountain bikes are specially designed for off-road cycling and include both dual"+'\n'+"
and full suspension, large knobby tires which make it more durable.");

public class first { public static void main(String[] args)

Mtb obj1 =new Mtb();

obj1.type();

obj1.Bikespeed();

obj1.noofgear();

obj1.defination();

3. Result/Output/Writing Summary:

Output of 1st Program:

select your vehicle type

1.Bike

2. car

Max Speed of bike 310 k/m


Max Gear a Bike have is 6

Mountain bikes are specially designed for off-road cycling and include both dual and full suspension, large
knobby tires which make it more durable.

Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Demonstration and Performance 5
(Pre Lab Quiz)
2. Worksheet 10
3. Post Lab Quiz 5

You might also like