pragma solidity ^0.7.4; contract Project{ address owner; uint public balance; string public Fname; string public Lname; uint public age; enum GENDER {MALE, FEMALE, OTHER} GENDER public choice; struct Address{ string AddressLine1; string AddressLine2; string City; string state; string Pincode; } Address a1; function Alias() public view returns(string memory, string memory, string memory, string memory, string memory, string memory, string memory){ /*accessing the struct objects*/ return ( Fname, Lname,a1.AddressLine1,a1.AddressLine2,a1.City,a1.state,a1.Pincode); } function Approval() public{ owner=msg.sender; } function Create_Account(string memory First_name, string memory Last_name, uint Age, uint gender, string memory addressline1,string memory addressline2, string memory city, string memory State, string memory pincode) public{ /*function to enter the first name*/ Fname=First_name; Lname=Last_name; age=Age; choice=GENDER(gender); /*(0=MALE,1=FEMALE, 2=OTHER)*/ a1.AddressLine1=addressline1; a1.AddressLine2=addressline2; a1.City=city; /* Function to Create an account*/ a1.state=State; a1.Pincode=pincode; } function Edit_Account(address,string memory First_name, string memory Last_name, uint Age, uint gender, string memory addressline1,string memory addressline2, string memory city, string memory State, string memory pincode) public{ require(address(owner)==msg.sender); { Fname=First_name; Lname=Last_name; age=Age; choice=GENDER(gender); /*(0=MALE,1=FEMALE, 2=OTHER)*/ a1.AddressLine1=addressline1; a1.AddressLine2=addressline2; a1.City=city; /* Function to Create an account*/ a1.state=State; a1.Pincode=pincode; } } function Deposit_Balance(address) public payable{ /*function for deposit*/ balance=balance+msg.value; } function getBalance() public view returns(uint){ /*getbalance() is an additional function to check if the balance is right*/ return address(this).balance; } function Withdraw_Balance(address payable to) public{ /*function for withdrawal*/ require(owner == msg.sender); to.transfer(this.getBalance()); } }
0.4.18