Question: Develop a program in C and upload it into your Arduino Mega 2560 board to implement a simple credit card management system. The Arduino Mega
Develop a program in C and upload it into your Arduino Mega 2560 board to implement a simple credit card management system. The Arduino Mega 2560 should interact with the user via the Serial Monitor. The program should do as described below. An example is given after the following description.
Display the following information on the Serial Monitor: Unit code and title, your name, your student ID.
Set Pins 14 to 21 of Arduino Mega board as inputs. Enable the internal pull-up resistor for each of these pins.
Prompt the user to select one of the following options:
Add New Account //assume we will have maximum 10 accounts
Account Information //Name, Card Number, Expiry Date, Password
Deposit Funds //Based on Card Number
4. Withdraw Funds //Based on Card Number
Receive the users selection via the Serial Monitor, e.g. 1, 2, or 4.
Depending on the selected option, prompt the user to enter relevant input information, and then implement the stated action/display as follows:
For 1:
Full Name: //First Name Last Name, max 30 characters
// show full name to user
Credit Card Number: //6 digits entered, show digits to user
//Receive the digits as a string of 6 characters
Expiry Date: //4 digits, show digits to user
//Receive digits as a string of 4 characters
Password: //User selects an 8-bit password by connecting
//some of the Pins 14 to 21 of Arduino to GND
// with jumper wires, the rest would be VCC due
// to pull-up resistors, then presses Enter key
// show the 8-bit code to user
/*Store the entered information, plus $0 for account balance, into appropriate variables*/
For 2:
Credit Card Number: //6 digits entered, show digits to user
//Receive the digits as a string of 6 characters
Password: //User selects an 8-bit password by connecting
//some of the Pins 14 to 21 of Arduino to GND
// with jumper wires, the rest would be VCC due
// to pull-up resistors, then presses Enter key
// show the 8-bit code to user
/*Compare 6-digit Card Number with the Card Numbers stored in the system.
If a match is found, then check the entered password against the stored password.
Display the following if passwords matched. Otherwise, display Account not found! */
| Full Name: | // First Name Last Name | |
| Credit Card Number: | //6 digits | |
| Expiry Date: |
| //4 digits |
| Account Balance:
For 3: |
| //Latest account balance |
| Credit Card Number: |
| //6 digits entered, show digits to user |
|
|
| //Receive the digits as a string of 6 characters |
| Deposit Amount: $ |
| //user enters an integer amount and system |
|
|
| // shows amount to user |
/*Compare 6-digit Card Number with the Card Numbers stored in the system. If a match is found, add amount to the current account balance amount stored in a relevant integer variable. */
For 4:
| Credit Card Number: |
| //6 digits entered, show digits to user |
|
|
| //Receive the digits as a string of 6 characters |
| Withdraw Amount: $ |
| //user enters an integer amount and system |
|
|
| // show amount to user |
/*Compare 6-digit Card Number with the Card Numbers stored in the system. If a match is found, subtract entered amount from the current account balance amount stored in an integer variable. */
6. Go to Step 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
