Driving school

Under Review

UTILITYTOOLSDOCUMENTS

Contract purpose

This contract can be used to manage the operational flow of a driving school.

Exposed methods and variables

Instructor : holds all info regarding an instructor (first name, last name, number of students under evaluation, his car id) Student : holds all info regarding a student(first name, last name, age, number of remaining classes, their instructor id) Car : holds all info regarding a car(model, engine type(Diesel/gas/Hybrid), engine capacity in cm^3, year of fabrication)

instructors : holds all instructors students : holds all students cars : holds all cars

setInstructor - sets the info for a new instructor(can only be called by the owner of the contract)

parameter_nametypedetails
_fNamestringfirst name
_lNamestringlast name
_noOfStudentsuint256number of students under evaluation
_carIduintthe id of his car

getInstructor - returns the info of an instructor specified by id

parameter_nametypedetails
_iduintinstructor id

countAllInstructors - returns the total number of instructors countAvailableInstructors - returns the total number of instructors that have less than 20 students countAllStudents - returns the total number of students

checkAvailability - checks if a certain instructor is available(returns true if there are less than 20 students, false otherwise)

parameter_nametypedetails
_iduintinstructor id

enrollStudent - adds a new student, associating them with an instructor

parameter_nametypedetails
_instructorIduintinstructor id(must be available)
_fNamestringfirst name
_lNamestringlast name
_ageuinttheir age(must be at least 16)

BillSession - keeps track of driving sesions(marks one session as completed, reducing the remaining hours of a student)

parameter_nametypedetails
_instructorIduintinstructor id
_studentIduintstudent id

AddExtraHours - adds extra hours to the remaining hours of a student

parameter_nametypedetails
_studentIduintstudent id
noOfHoursuintnumber of extra hours

changeInstructor - changes a student's instructor

parameter_nametypedetails
_studentIduintstudent id
_newInstructorIduintinstructor id

addCar - adds a new car

parameter_nametypedetails
_modelstringcar model
_engineTypestringcan be diesel/gas/hybrid
_engineCapacityuintvolume in cm^3
_yearuintyear of fabrication

isCarAvailable - checks if a car is free(doesn't belong to any instructor)

parameter_nametypedetails
_carIduintcar id

changeCar - changes an instructor's car(the new one must be available)

parameter_nametypedetails
_newInstructorIduintinstructor id
_newCarIduintcar id

clearsSpot - when a student "graduates"(finishes his/her hours) a spot is made available

parameter_nametypedetails
_studentIduintstudent id
Reviewed by Modex
Buy
Buy Contract

Create an account or login to purchase this smart contract