We want to create an application that allows you to manipulate cars.
• Each car is defined by a registration number, a brand, quantity of fuel
and its speed. • All cars are assumed to have the same tank capacity equal to 50. Pratical Work 1 Mr. Mahrane Said • • To create a car, you need to know his registration number. The operations you want to perform on the car are: Course/Module: Object Oriented o addFuel (int c): adds a quantity of fuel "c" to the current Programming JAVA quantity o start(): displays a message indicating that the car is starting by Exercise n°1 : displaying the registration number, the brand and the quantity A student will be modeled here by the class Student of a package named of fuel of this car. Before this message, the fuel quantity must gestionStudent, as follows. be reduced by 1. The class Student has three attributes: o Accelerate(): displays a message that indicates that the car is accelerating by displaying the registration number, the brand, His name named name, of type String, the quantity of fuel and the speed of the car. Before displaying a first name named first name, of String type, this message, it is necessary to reduce the amount of fuel by 2 his age type int and add more 4 to the speed. and the class of type String o Stop(): indicates that the car is stopped, by initializing the speed to 0. The student class has: o toString(): method that returns a character string of the type • a public constructor which has four parameters used to initialize the “Car registration number =…, brand=…, Fuel=…, Speed=…. » student; • a public constructor without parameters. Required work : • a public String toString() method which returns a description of the 1. Make a UML representation of the Car class. student considered (for example: "Ali Abdi 22 years old Engineering") 2. Create a TestVoiture class belonging to the default package: You are then going to create alongside the class Student a class TestStudent a) Create a car with serial number 1 (also in the package gestionStudent) containing a main method which: b) Add 30 to the amount of fuel. c) Display the status of this car • creates two student objects (instance of class Student). d) Start the car • Display student status using the toString() method; e) Accelerate the car f) Show car status again g) Stop the car Exercise n°2: h) Show car status again