Use the scaffold code provided for this task. Complete the following code requirements in the Ruby language
Question:
Use the scaffold code provided for this task. Complete the following code requirements in the Ruby language for the file car.rb. Your final code must be structured and run.
Requirements:
1. You must create a record for a car. A car has the following attributes: an id (integer), a manufacturer (string), a model (string), and kilometres driven (integer). In your code create a Ruby class that can be used to create records for the car.
2. Write a function called read_car() that reads from the terminal values for each of the fields in an Car record and returns the completed record.
3. Write a procedure called display_car(car) that takes an car record and writes each of the fields to the terminal with a description for the field as well as the field value.
4. Write a function called read_cars() that calls your read_car() and returns an array of Cars.
5. Write a procedure called display_cars(cars); that calls your display_car(car) procedure for each car in the array.
6. Use the following code in your main() to test your program:
Code;
def read_cars()
end
def print_car(car)
end
def print_cars(cars)
end
def main()
cars = read_cars()
print_cars(carss)
end
main()
Managerial Accounting
ISBN: 978-1118385388
2nd edition
Authors: Ramji Balakrishnan, Konduru Sivaramakrishnan, Geoff B. Sprinkle