Last active
October 12, 2019 07:06
-
-
Save xProgrammer-007/97b3ed754efa2b70cf7066bc1ee6131f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a company wants me to create a game where a car, car should have its name , its topspeed and its wheelname | |
void main(){ | |
Bike bike= new Bike(); | |
bike.name ="pulsar"; | |
bike.no_of_wheels=2; | |
bike.speed_of_vehicle="130 rpm"; | |
bike.number_of_gears=4; | |
print("the name of the bike - ${bike}\n"); | |
print("no_of_wheel - ${bike.no_of_wheels}"); | |
print("speed_of_vechile - ${bike.speed_of_vehicle}\n"); | |
print("number_of_gears - ${bike.number_of_gears}\n"); | |
Car car= new Car(); | |
car.company_name="scoprio"; | |
car.number_plate_of_car=12345; | |
car.number_of_persons_sit=4; | |
print("company_name - ${car.company_name}\n"); | |
print("number_plat_of_car - ${car.number_plate_of_car}\n"); | |
print("number_of_persons_sit - ${car.number_of_persons_sit}\n"); | |
} | |
class Car extends Vehicle{ | |
String company_name; | |
int number_plate_of_car; | |
int number_of_persons_sit; | |
} | |
class Bike extends Vehicle{ | |
} | |
class Vehicle{ | |
int no_of_wheels; | |
String name; | |
String speed_of_vehicle; | |
int type_of_the_engine_number; | |
int number_of_gears; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment