Ski Instructors

Under Review

UTILITY

Contract purpose

This contract can be used to manage the situation of ski instructors in a ski school.

Exposed methods and variables

Instructor : holds all info regarding an instructor (first name, last name, age group(represented by a minimum and a maximum age students can be) and current number of students)

instructors : holds a mapping of ids to Instructors instructorAccounts : holds all the ids

Student : holds all info regarding a student(id, first name, last name, age and the id of the associated instructor)

students : holds a mapping of ids to Students studentsAccounts : holds all the ids

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

parameter_nametypedetails
_iduintinstructor's id
_fNamestringfirst name
_lNamestringlast name
_ageMinuint256the minimum age for students
_ageMaxuint256the maximum age for students
_noOfStudentsuintcurrent number of students in instructor's class

getInstructor - returns the info of an instructor specified by id

parameter_nametypedetails
_iduintinstructor's id

getInstructors - returns all the adresses of the instructors

countAllInstructors - returns the total number of instructors

checkAvailability - checks if a certain instructor has any vacant spots(true if the current number of students is less than 20, false otherwise)

parameter_nametypedetails
_iduintinstructor's id

checkNumberOfAvailableSpots - returns how many available spots an instructor has

parameter_nametypedetails
_iduintinstructor's id

addStudentToTeam - enables the owner to add a new student to an instructor's team(after checking for available spots and for their age to be in the specified range)

parameter_nametypedetails
_InstructorIduintinstructor's id
_iduintstudent's id
_fNamestringstudent's first name
_lNamestringstudent's last name
_ageMinuint256student's age

getStudent_sInstructor - returns the first and last name of the instructor of a specific student

parameter_nametypedetails
_iduintstudent's id

countAllStudents - returns the total number of students

Reviewed by Modex
Buy
Buy Contract

Create an account or login to purchase this smart contract