Coursework 1 for Programming I (COMP-1312)
Banking System by Mah Han Cheng
- Creating new bank accounts
- Deposit into / Withdraw from registered bank accounts
- Remittance
- Delete bank accounts
-
Creates account with:
- Name (3 to 32 characters)
- Identification number (12-digit number)
- Account number (Randomly generated between 10,000 to 1,000,000)
- Account type (1 = Savings, 2 = Current Account)
- Amount (Balance default RM 0.00)
-
Creates a 'database' folder to store accounts
-
Creates files in the 'database' folder, storing account information using the name "account_number.txt".
- Deposits to / Withdraws from selected bank accounts
- Checks if amount to withdraw is valid and not out of bounds (greater than 10 digits) to prevent overflow
- Checks if balance is enough to withdraw
- Checks if account contents are correct
- Delete the specified bank account from the database (Recovery is not avaliable)
- Transfers money from one account to another
- With remittance fee deducted from the sender:
- From Current Account to Savings Account (2% fee)
- From Savings Account to Current Account (3% fee)
- Checks if amount to withdraw is valid and not out of bounds (greater than 10 digits) to prevent overflow
- Checks if balance is enough to withdraw
- Checks if account contents are correct
- C version: c17
-
Install a c compiler (mingw / winlibs) and add the binary directory to path.
-
To check if the compiler has installed: In Command Prompt (cmd):
gcc --version
-
In cmd / powershell, run:
gcc banking_system_application.c -o banking_system_application # To compile -
To run:
banking_system_application.exe # in cmd./banking_system_application.exe # in powershell -
The program should run perfectly now 🎉🎉🎉!!!
-
GCC normally comes preinstalled, just run in terminal:
gcc banking_system_application.c -o banking_system_application && ./banking_system_application -
If GCC is not found / installed, run in terminal to install gcc:
sudo apt install build-essential
-
and test install with:
gcc --version
-
Go to App Store and install XCode, Apple's compiler
-
Go to Terminal and run to install the command line tools of XCode:
xcode-select --install
-
The setup should be done. To compile the file, run in Terminal:
gcc -Wall -o banking_system_application banking_system_application.c # compile -
On newer versions of OS X, you can choose to compile with:
clang banking_system_application.c -o banking_system_application # compile -
Then run the executable with:
./banking_system_application # run program
- Compiling C on MacOS Based on code by Mark Setchell, Stack Overflow: https://stackoverflow.com/questions/32337643/how-can-i-run-a-c-program-on-mac-os-x-using-terminal
- How to Install GCC Compiler on Linux? by anuragsingh1022, GeeksforGeeks: https://www.geeksforgeeks.org/how-to-install-gcc-compiler-on-linux/
- C program to list all files in a directory recursively, Codeforwin: https://codeforwin.org/c-programming/c-program-to-list-all-files-in-a-directory-recursively