ok i seperated the two now it looks like this which makes it more readable but it gives me this error:
48 request for member `setName' in `User', which is of non-aggregate type `newUser ()()'
it gives me this for every member of the newUser class
what does it mean
bank.cpp:
Code:
#include <iostream.h>
#include <fstream.h>
#include <conio.h>
#include <newUser.h>
int main()
{
char quit;
quit = '\0'; //quiting when q pressed
while (quit != 'q')
{ //start of program
//decleration of variables
int option;
char userName;
float money;
float rate;
int years;
char moneytype;
cout<<"|----------------|"<<endl;
cout<<"| Bank Program |"<<endl;
cout<<"|----------------|"<<endl<<endl<<endl;
cout<<"1. New User"<<endl;
cout<<"2. Previous User"<<endl;
cout<<">>";
cin>>option;
if (option!=1 || option!=2)// check menu input
{
cout<<"Please choose only from the given options"<<endl<<endl;
cout<<"1. New User"<<endl;
cout<<"2. Previous User"<<endl;
cout<<">>";
cin>>option;
}//end check menu
switch (option)
{ //start of option menu
case 1:
newUser User();
cout<<endl<<"Please give us your name: ";
cin>>userName;
User.setName(userName);
cout<<endl<<"How much money are you putting on the bank? ";
cin>>money;
User.setAmount(money);
cout<<endl<<"What currency is the money (eg $)? ";
cin>>moneytype;
User.setCurrency(moneytype);
cout<<endl<<"What is the intrest rate of the Bank? ";
cin>>rate;
User.setIntrest(rate);
cout<<endl<<"How long are you keeping it there? ";
cin>>years;
User.setTime(years);
cout<<endl<<endl<<"You are keeping "<<User.getCurrency()<<User.getAmount()<<" for "<<User.getTime()<<" years, at "<<User.getIntrest<<"% intrest rate";
cout<<"Start amount: "<<User.getCurrency()<<User.getAmount;
cout<<endl<<endl<<User.getIntrest()<<"% Intrest"<<endl<<endl<<"For "<<User.getTime()<<" Years"<<endl<<endl;
//start of setting all the values
cout<<endl<<endl<<"Thank you "<<User.getName()<<" for your time";
break;
case 2:
break;
} //end of menu
} //end of quitting when q pressed
return 0;
} //end of file
newUser.h:
Code:
#ifndef newUser_H
#define newUser_H
class newUser //New User start
{
public:
newUser();
void setName(char userName);
void setAmount(float money);
void setIntrest(float rate);
void setTime(int years);
void setCurrency(char moneytype);
void calculate(float amount, float intrest, int time, char currency);
char getName();
char getCurrency();
float getAmount();
float getIntrest();
int getTime();
private:
char name;
float amount;
float intrest;
int time;
char currency;
}; //end new user
newUser::newUser()
{
}
void newUser::setName(char userName)
{
name = userName;
}
void newUser::setAmount(float money)
{
amount = money;
}
void newUser::setIntrest(float rate)
{
intrest = rate;
}
void newUser::setTime(int years)
{
time = years;
}
void newUser::setCurrency(char moneytype)
{
currency = moneytype;
}
void newUser::calculate(float amount, float intrest, int time, char currency)
{
for(int x=0;x<time;x++)
{
amount = ((intrest/100)*amount)+amount;
cout<<currency<<amount<<" <------Year "<<x<<endl<<endl;
}
}
char newUser::getName()
{
return name;
}
char newUser::getCurrency()
{
return currency;
}
float newUser::getAmount()
{
return amount;
}
float newUser::getIntrest()
{
return intrest;
}
int newUser::getTime()
{
return time;
}
#endif