Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.72 KB

interface.md

File metadata and controls

32 lines (24 loc) · 1.72 KB

Ferrari

Model an application which contains a class Ferrari and an interface. Your Ferrari should have functionality to use brakes and push the gas pedal. When the brakes are pushed down print "Brakes!", and when the gas pedal is pushed down - "Wruuuuuuummmmm!". This functionality is typical for all cars, so you should implement an interface to describe it. You also should have a Model propery for your Ferrari. Your class should have a constructor.

  • Make sure that your Ferrari Model is only "488-Spider" There is no need to read input from console. Just make sure you instantiate and populate the class with everything it needs to be valid.

Citizen and Robots

In the future Citizens and Robots will live on the planet Mars as brothers. The only thing that citizens and robots in common is their Ids. A Citizen has 2 extra characteristics, age and name. A Robot has an extra characteristic, named Model. Define and implement this ‘models’.

Birthdays

It is a well known fact that people celebrate birthdays, it is also known that some people also celebrate their pets’ birthdays. Extend the program from your last task to add birthdates to citizens and include a class Pet, pets have a name and a birthdate. Encompass repeated functionality into interfaces and implement them in your classes.

Residents and Persons

Create 2 interfaces IResident and IPerson. IResident should have a name, country and a method GetName(). IPerson should have a name, an age and a method GetName(). Create a class Citizen which implements both IResident and IPerson, explicitly declare that IResident’s GetName() method should return “Mr/Ms/Mrs ” before the name while IPerson’s GetName() method should return just the name.