Question: Write a C++ program that simulates the operation if a simple online banking system. The program starts by displaying its main menu as shown in

Write a C++ program that simulates the operation if a simple online banking system. The program starts by displaying its main menu as shown in Figure 1. Figure 1 Main menu of the program The menu is composed of the following choices: 1. When choice 1 is selected (Display Account information), the program should display account information and account balance. This information (account information and account balance) is stored in two separate text files accountInfo.txt and balance.txt, respectively. Figure 2 shows sample examples of these two files. Figure 2 Text files: accountInfo.txt and balance.txt Once choice 1 is selected, the content of these files should be displayed as shown in Figure 3. After that the program start over displaying the main menu again once the Enter Key is pressed. Figure 3 Output of Display Account Information choice 2. When choice 2 (withdrawal money) is selected, the program should ask the user to enter withdrawal amount which should be validated (withdrawal amount should be positive and less than the account balance). This shown in Figure 4. Page 3 of 6 Figure 4 Withdrawal selection and validation Once a valid value is entered, it should be subtracted from the balance value, which is stored in file balance.txt, and then the file should be updated with the new balance value. To update the file you need to open the file for output; the new balance value is then can be saved to the file removing the old value. This can be done in C++ using the following: fstream outFile; outFile.open("balance.txt", ios::out | ios::trunc); where: (ios::out) for output mode, (ios::trunc) for removing the file content if it does exist, and ( | ) for combining both operation opening as output file and removing it old content. 3. When choice 3 (Deposit) is selected, the program should ask the user to enter deposit amount which should be validated as positive value only. Once a valid value is entered, it should be added to the balance value, which is stored in file balance.txt, and then the file should be updated with the new balance value. This also can be accomplished as explained in point 2 above. 4. When choice 4 (Verify Your Credit Card) is selected, the program should read your credit card (for example: 5278576018410707) and verify whether it is valid or not. In addition, the program must display the type (i.e. name of the company that produced the card). Each credit card must start with a specific digit (starting digit: 1 st digit from left to right), which also is used to determine the card type according Table 1. Page 4 of 6 Figure 5 Credit Card Number Verification Table 1. Credit card types based on the starting digit (left to right) The total number of digits of a credit card number must be between 13 to 16 digits. In addition, your program should validate credit card numbers according to Luhn Rule that is basically can be described as follows (as an illustration, the rules will be applied to the credit card number 4388576018402626): A. Double every even digit from right to left. If the doubling results in two digits number, sum the digits to get a single digit number. B. Compute the sum of single digit numbers obtained from step A above: Sum of even single-digits = 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 C. Compute the sum of every odd digit from right to left: Sum of odd digits = 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 D. Compute the sum of the results from step B and step C: Total sum = 37 + 38 = 75 E. If the total sum from step D is divisible by 10, the card number is valid. Otherwise, it is not valid. Is 75 divisible by 10 (without remainder)? No, the card number in this example is Invalid. Sample examples of this menu choice is shown in Figure 5. Starting Digit Card Type 3 American Express 4 Visa 5 MasterCard 6 Discover Card Page 5 of 6 The following credit card numbers can be used to test your program: Card Number Valid? Card Type 5278576018410707 Yes MasterCard 373800410401774 Yes American Express 4388576018402626 No - 601195764182 No - 5. When choice 5 (Quit Application) is selected, the program should stop. 6. After displaying each selection, you need to clear the screen. In windows, you can use the function call system("cls");. But in MacOS using the xcode, the best way to do it is by using something like: cout << string( 100, ' ' );. Notes: to get the full credit of the project, you should follow these notes A. You should use functions wherever possible. B. There should be two text files in your project folder. You can use the information shown in Figure 2. Your program should display appropriate error messages if any of these files cannot be opened or found. C. Credit card numbers are usually large, so use long long to represent the corresponding variables of this value. D. The project should be done in groups of two students. E. Names, IDs, and section of students must be written as comments at the top of the file. // Students Names & IDs // Name1: *****************, ID1: ******************* // Name2: *****************, ID2: ******************* // Section: ******** F. The deadline of the project will be the last day of classes 13/12/2018. You should come and discuss your project implementation during office hours or by appointment before the deadline expiry. No late discussions will be accepted. Page 6 of 6 G. All of the program must be indented properly wherever is needed/required. For example, the bodies of looping structures, if statements, user-defined functions ... etc. Good Luck C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!