Skip to content

Redi School - Java Intermediate - OOP Class & Objects - Creating a Car class and using it in different ways

Notifications You must be signed in to change notification settings

ab-dulla/redi-car-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

redi-car-exercise

Redi School - Java Intermediate - OOP Class & Objects - Creating a Car class and using it in different ways.

Exercise (easy)

Create a Java class for the real-life object “Car”:

  • Name your class file “Car”.
  • You want to store the name of the car (a String).
  • You want to store the fuelLevel of the car (a number between 0 and 100).
  • You also want to store the maxSpeed of the car (a number).
  • You also want to know if the car is broken (a boolean).
  • You want the car to be able to drive() and to refuel().

And then use the class “Car” by creating a new car object called “Mini”.


The solution is stored in this Github repository. You could try to solve the exercise before checking it out.

Please note that there is no single correct solution for this exercise; I've just chosen a simple one and there is for sure other valid / better solutions.

About

Redi School - Java Intermediate - OOP Class & Objects - Creating a Car class and using it in different ways

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages