forked from priyanshu-bhatt/Hactoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarks_Management_System.sol
41 lines (32 loc) · 1023 Bytes
/
Marks_Management_System.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pragma solidity >= 0.7.0<0.8.0;
//Build the Contract
contract MarksManagmtSys{
//Create a structure for student details
struct Student{
int ID;
string fName;
string lName;
int marks;
}
address owner;
int public stdCount=0;
mapping(int=>Student) public stdRecords;
modifier onlyOwner{
require(owner == msg.sender);
_;
}
constructor(){
owner=msg.sender;
}
//Create a function to add the new records
function addNewRecords(int _ID,string memory _fName,string memory _lName,int _marks) public onlyOwner{
//increase the count by 1
stdCount=stdCount+1;
//fetch the student details with the help of stdCount
stdRecords[stdCount]= Student(_ID, _fName, _lName, _marks);
}
//Create a function to add bonus marks
function bonusMarks(int _bonus) public onlyOwner{
stdRecords[stdCount].marks= stdRecords[stdCount].marks + _bonus;
}
}