pragma solidity ^0.4.24; contract GymInstructors{ address owner; function GymInstructor() public{ owner = msg.sender; } modifier onlyOwner{ require(msg.sender == owner); _; } struct Instructor{ string fName; string lName; uint age; string field; } mapping(address => Instructor) instructors; address[] public instructorAccounts; //sets the info for a new instructor function setInstructor(address _address, string _fName, string _lName, uint _age, string _field)onlyOwner public{ var instructor = instructors[_address]; instructor.fName = _fName; instructor.lName = _lName; instructor.age = _age; instructor.field = _field; instructorAccounts.push(_address) -1 ; } //returns all the instructor accounts function getInstructors() public returns(address[]){ return instructorAccounts; } //returns the info of an instructor specified by address function getInstructor(address _address) view public returns(string fn, string ln, uint a, string fld){ return(instructors[_address].fName, instructors[_address].lName, instructors[_address].age, instructors[_address].field); } //returns the total number of available instructors function countAllInstructors() public returns(uint){ return instructorAccounts.length; } //returns true if a certain instructor is specialized in the given field, false otherwise function checkField(address _address, string _field) public returns(bool){ require(keccak256(abi.encodePacked(instructors[_address].field)) == keccak256(abi.encodePacked(_field))); return true; } }