I am developing a university management system using ethereum. So,for that I need an entity "Student" and I have created a smart contract with some basic functionalities. Here is my code snippet for student.sol
pragma solidity ^0.5.0;
contract student
{
string private name;
string private birthdate;
string private department;
string private location;
string private email;
uint256 private id;
uint256 private mobile_no;
uint256 counter=0;
function setName(string memory myname) public
{
name=myname;
}
function getName() public view returns(string memory )
{
return name;
}
constructor ()public
{
id=counter+1;
counter=counter+1;
}
function getid() public view returns(uint256 id1)
{
id1=id;
return id1;
}
function setbirthdate(string memory _birthdate) public
{
birthdate = _birthdate;
}
function getbirthdate() public view returns(string memory )
{
return birthdate;
}
function setdepartment(string memory mydepartment) public
{
department = mydepartment;
}
function getdepartment() public view returns(string memory )
{
return department;
}
function setlocation(string memory mylocation) public
{
location= mylocation;
}
function getlocation() public view returns(string memory )
{
return location;
}
function setmobileno(uint256 myphonenumber) public
{
mobile_no = myphonenumber;
}
function getmobileno() public view returns(uint256 )
{
return mobile_no;
}
}
I have used web3.js to interact between the smart contract and web page. Now I want to create an array of student object and use them whenever I need to create a student. How can I do it? Please help me