|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi !
Help with my code i have to write a program that prompts the following from the user:account number, an account type (s for savings and c for checking), minimum balance, and current balance. then the prog should output: the account number, the full account type (savings or checking), the current balance, and a message as described below. For savings accounts, the output current balance is the input balance plus 4% interest. Also a service charge of $10 is subtracted for balances below minimum balance. A message will say whether a charge or interest is in effect. For checking accounts, the output balance is input balance plus 5% interest of amounts up to $5000 over the minimum balance and 3% for excess amounts. Also $25 is charged for balances below minimum balance. A message is displayed as in the savings case. Here is suggested test data: 46728 S 1000 2700 87324 C 1500 7689 79873 S 1000 800 89832 C 2000 3000 98322 C 1000 750 i changed the code, fixed few errors, here is the New code and the errors below: Once again your help and your kindness will be appreciated! Code:
#include<iostream>
using namespace std;
int main(){
int accounttype;
int totalamount;
int minimbalance;
int currentbalance;
int select = 0;
int accountnumber;
// select 1 = savings;
// select 2 = checkings;
cout << "choose from the followings: 1 for savings 2 for checkings " ;
cin >> select;
cout << " enter your minimum balance ";
cin >> minimbalance;
cout << " enter your current balance ";
cin >> currentbalance;
cout << " what is your account number? Please enter your account number " ;
cin >> accountnumber;
if (select == 1)
{
if (currentbalance < minimumbalance)
totalamount = currentbalance - 10;
}
else
if (currentbalance >= minimumbalance)
{ totalamount = currentbalance * 1.04 ;
if (select == 2)
{
if (currentbalance < minimbalance)
totalamount = currentbalance - 25;
}
else
if (currentbalance >= minimbalance && >= 5000)
{
totalamount = currentbalance * 1.05 ;
}
else
if (currentbalance < minimbalance && <= 5000)
totalamount = currentbalance * 1.03 ;
}
cout << " your account type is " << accounttype << " your account number is " << accountnumber << endl;
cout << " and your current balance which is your Total balance is " << totalamount << endl;
cout << endl;
}
account.cpp:30: error: âminimumbalanceâ was not declared in this scope account.cpp:32: warning: converting to âintâ from âdoubleâ account.cpp:43: error: expected primary-expression before â>=â token account.cpp:45: warning: converting to âintâ from âdoubleâ account.cpp:48: error: expected primary-expression before â<=â token account.cpp:49: warning: converting to âintâ from âdoubleâ Last edited by WingedPanther; 07-17-2008 at 12:22 PM. Reason: add code tags |
| Sponsored Links |
|
|
|
|||||
|
(currentbalance >= minimbalance && >= 5000)
(currentbalance < minimbalance && <= 5000) These are invalid syntax. They should be: ((currentbalance >= minimbalance) && (currentbalance >= 5000)) ((currentbalance < minimbalance) && (currentbalance <= 5000))
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Basic Calculator | AfTriX | VB Tutorials | 3 | 02-29-2008 09:53 AM |
| How to write the code to delete the whole binary search tree ?? | worried_student | C and C++ | 1 | 11-23-2007 11:09 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |