Need help please.

OVERVIEW
Object bankAccount
properties: balance, acctNumber, userName

Object startMenu

Object accountMenu

Main
Start Menu
1 Create Account
2 Access Account
3 Quit

1 Create Account
Prompt for userName
We assign a unique random number for account and store the unique accountNumber somewhere and make sure it's not a collision
We store a balance of 0.00 and save it
Go back to Start Menu

2 Access Account
Prompt their userName, and accountNumber
If correct, we show the Account Menu
If false, go back to Start Menu

3 Account Menu
1 Read Balance
2 Update Balance
3 Delete Account
4 Go back to Start Menu

1 Read Balance
Spit out balance
Go back to Account Menu

2 Update Balance
Enter amount to update balance (use negative if deduction)
User enters amount, if bad we reprompt an amount
We spit out new balance
Go back to Account Menu

3 Delete Account
Ask user if they are sure
Yes, delete account
No, go back to account menu

4 Go back to Start Menu
Go back to start menu

CODE
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>

using namespace std;

int main()
{
int startMenuChoice = 0;
//Create start menu loop
//Print out menu and wait for user input
do
{
cout << "Start Menu\n";
cout << "1 Create Account\n";
cout << "2 Access Account\n";
cout << "3 Quit\n";
cout << "Please choose one of the options: ";
cin >> startMenuChoice;

switch (startMenuChoice)
{
case 1:
cout << "You've selected create account";
break;
case 2:
cout << "You've selected access account";
break;
case 3:
cout << "You've selected quit";
break;
default:
cout << "Invalid input";
}
} while (startMenuChoice != 3);
}


This is an assignment that I am doing. The overview of what I want the program to do is at the top and the bottom is what I have so far.

What I need to add:

1. Add arrays to program to handle more data.

2. Create a hierarchy chart showing the logical components of the program. Modularize the code according to chart. Menu should call individual modules to do the work of the program.

3. Add the ability to save data to disk in one or more files. The menu(s) should give the user the option to save or retrieve data.

Thanks a bunch!
OP's code, formatted and put in code blocks:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>

using namespace std;

int main() {
  int startMenuChoice = 0;
  // Create start menu loop
  // Print out menu and wait for user input
  do {
    cout << "Start Menu\n";
    cout << "1 Create Account\n";
    cout << "2 Access Account\n";
    cout << "3 Quit\n";
    cout << "Please choose one of the options: ";
    cin >> startMenuChoice;

    switch (startMenuChoice) {
      case 1:
        cout << "You've selected create account";
        break;
      case 2:
        cout << "You've selected access account";
        break;
      case 3:
        cout << "You've selected quit";
        break;
      default:
        cout << "Invalid input";
    }
  } while (startMenuChoice != 3);
}


Okay. That's a pretty good overview of what you need to do. What would you like from us?

-Albatross
I need to incorporate arrays.

-Mike
Last edited on
mikeycc wrote:
I need to incorporate arrays.
Albatross wrote:
Okay. That's a pretty good overview of what you need to do. What would you like from us?
Start with a thing.
1
2
string userName;
cin >> userName;


Then several related things.
1
2
3
4
5
6
7
8
struct bankAccount {
  int balance;
  string acctNumber;
  string userName;
};

bankAccount myAccount; // you now have one account
cin myAccount.userName;


mikeycc wrote:

I need to incorporate arrays.

Then arrays of those related things.
1
2
bankAccount myAccounts[100]; // you now have one hundred accounts
cin myAccounts[0].userName;


The point of this is to show you that you can easily evolve the s/w through a number of steps.

The trick is to not look at your assignment and panic at not being able to write the whole thing in a single keyboard session.
It begins on paper, where you sketch out ideas for intermediate steps that get you to your goal.

A good place to start would be a single account without an account number.

Registered users can post here. Sign in or register to post.