Write a program that uses a structure to store the following data about a customer account:
* Name (full name in one variable)
* Address (full street address in one variable)
* City, State and Zip
* Telephone number
* Account balance
* Date of last payment
The program should use an array of at least 20 structures. It should let the user enter data into the array, change the contents of any element and display all the data stored in the array. The program should have a menu-driven interface and use functions as appropriate.
Input validation: when the data for a new account is entered, be sure the user enters data for all the fields (no empty fields). No negative account balances should be entered.
Help need with:
1) calling the function to display just the balance.
2) calling the function just too allow the person edit the balance.
-I dont know how to call a different customer (i.e. 2 customers they want to edit #2)
#include <cstdlib>
#include <iostream>
using namespace std;
void Acc(string , int, int AcArray[]);
void Load(string, string, int AcArray[]);
void Display(int AcArray[]);
void menu();
double CBalance(int AcArray[]);
void question();
struct account
{
char name[30]; //customer name
char address[30]; // address
char city[16]; //city
char state[2]; // State two letters
char zip[5]; // zip 5 numbers
char tele[12]; // telephone number 12 characters
double account; // account total
char date[20]; // date
int total[30]; // total array length
};
int main(int argc, char *argv[])
{
int AcArray[30];
//menu;
system("PAUSE");
return EXIT_SUCCESS;
}
void menu
{
int choice;
cout << "Welcome to you account management software, which action would you like to take?" << endl;
cout << "Press 1. Enter a new account." << endl;
cout << "Press 2. Display current account balances." << endl;
cout << "Press 3. Edit current accounts." << endl;
cout << "Press 4. Edit current balance of an account." << endl;
cin >> choice;
swtich(choice)
{
case 1:
cout << "You have chosen to enter a new account." << endl;
Acc;
break;
case 2:
CBalance;//call account balance function
break;
case 3:
cout << "Which account would you like to edit?"
//Display account numbers
//Call account number selected
break;
case 4:
cout << " Which account balance would you like to edit?"
//Display all current account numbers
//Call the array stored with account selected number
}
}
void question
{
char YN;
cout << "Would you like to return to the main menu y or n?";
cin >> YN;
switch(YN)
{
case y:
menu;
break;
case n:
return 0;
break;
}
}
double CBalance(int AcArray[])
{
cout <<"current balance is: " << account << endl;
}
void Acc(int total, int c, AcArray[])
{
cout << "How many account would you like to have?";
cin >> total;
Accout AcArray[total]
for(int c = 0; c < total; c++)
{
Load(total, c, AcArray);
}
for(int d = 0; d < total; d++)
{
Display(AcArray);
}
}
void Load(int total, int c, AcArray[])
{
cout << "Enter the full name of customer(First Last) ";
cin >> name;
cout << endl;
cout << "Enter the Address(i.e. 3470 NW 193 ST) of the customer ";
cin >> address;
cout << endl;
cout << "Enter the City of customer ";
cin >> city;
cout << endl;
cout << "Enter the State of customer ";
cin >> state;
cout << endl;
cout << "Enter the Zip Code of customer ";
cin >> zip;
cout << endl;
cout << "Enter the Telephone number(i.e 4597894561) of customer ";
cin >> tele;
cout << endl;
cout << "Enter the current account balance(i.e 789.55) of customer ";
cin >> account;
cout << endl;
cout << "Enter the last Day(i.e March 5, 2009) paid by customer ";
cin >> date;
cout << endl;
}
void Display
{
cout << " Customer " << c << " Name is " << AcArray[] << endl;
cout << " Customer " << c << " Address is " << AcArray[] << endl;
cout << " Customer " << c << " City is " << AcArray[] << endl;
cout << " Customer " << c << " State is " << AcArray[] << endl;
cout << " Customer " << c << " Zip Code is " << AcArray[] << endl;
cout << " Customer " << c << " Telephone number is " << AcArray[] << endl;
cout << " Customer " << c << " current account balance is $" << AcArray[] << endl;
cout << " Customer " << c << " last Day paid is " << AcArray[] << endl;
}

New Topic/Question
Reply




MultiQuote




|