Skip to content

Instantly share code, notes, and snippets.

@Bashta
Created February 6, 2022 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bashta/df8919baa49fb6bc769d28f3d9c8739b to your computer and use it in GitHub Desktop.
Save Bashta/df8919baa49fb6bc769d28f3d9c8739b to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=builtin&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// Defines basic contract dependecies to initiate
contract MarkingSytem {
// State variables to hold the initial 3 marks
uint public mark1;
uint public mark2;
uint public mark3;
// Flag to notify if first requirement is passed! "marks are with 10 pints of each other"
bool public isSetledInFirstRevision;
constructor(uint _mark1,
uint _mark2,
uint _mark3) {
mark1 = _mark1;
mark2 = _mark2;
mark3 = _mark3;
}
// Function takes no argmuents. They come as part of the contracts constructor.
// This means the 3 grades will be present during contract creation.
function getIsSetledInFirstRevision() public view returns (bool) {
if ((mark1 - mark2) < 10) {
return false;
} else if ((mark2 - mark3) < 10) {
return false;
} else if ((mark1 - mark3) < 10) {
return false;
} else {
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment