assignment needs a little help, well i do

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 5
Reputation: Intro2Prog is an unknown quantity at this point 
Solved Threads: 0
Intro2Prog Intro2Prog is offline Offline
Newbie Poster

assignment needs a little help, well i do

 
0
  #1
Nov 10th, 2004
1) Read an integer # from the file balance.dat that represents the balance on your checkbook (Assume integer #'s only)
2)let the user enter an amount to write a check.
3)If there is enough balance to write teh check then display the message (OK to write check) if the check is overdraft 350.00, from 1-50 dollars then the bank charges 5 dollars more to cash the check so display message (OK to write check , but 5 dollars will be charged due to NSF)
4) remember to chekc if the file exists before you do anything (usethe .fail() function)
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: assignment needs a little help, well i do

 
0
  #2
Nov 10th, 2004
Okay, what part are you having trouble with? Keep in mind that if you say you haven't done anything yet, I'll tell you to get lost. If you have done something, you'll need to prove it. Why? Because this is obviously homework, it's obviously easy if you put in a little effort, and maybe I just don't like you.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 5
Reputation: Intro2Prog is an unknown quantity at this point 
Solved Threads: 0
Intro2Prog Intro2Prog is offline Offline
Newbie Poster

Re: assignment needs a little help, well i do

 
0
  #3
Nov 10th, 2004
well ofcourse i have but right now i'm late for work, i will post my work in a while
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 5
Reputation: Intro2Prog is an unknown quantity at this point 
Solved Threads: 0
Intro2Prog Intro2Prog is offline Offline
Newbie Poster

Re: assignment needs a little help, well i do

 
0
  #4
Nov 10th, 2004
Originally Posted by Narue
Okay, what part are you having trouble with? Keep in mind that if you say you haven't done anything yet, I'll tell you to get lost. If you have done something, you'll need to prove it. Why? Because this is obviously homework, it's obviously easy if you put in a little effort, and maybe I just don't like you.


here's what i have
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int checkAmount;
  10. ifstream inBalance;
  11. ofstream outBalance;
  12.  
  13. inBalance.open("balance.dat");
  14.  
  15. if (inBalance.fail())
  16. {
  17. cout << "file balance.dat not found !!!!" << endl;
  18. getch ();
  19. exit(1);
  20. }
  21.  
  22. cout << "Please enter check amount: ";
  23. cin >> checkAmount;
  24.  
  25. if (inBalance <= 350)
  26. {
  27. cout << "ok to write check" << endl;
  28. }
  29.  
  30. if (inBalance >= 350)
  31. {
  32. cout << "OK to write check but 5 dollars will be charged due to NSF " << endl;
  33. }
  34.  
  35. if (inBalance > 100)
  36. {
  37. cout << "the bank will not pay this check" << endl;
  38. }
  39.  
  40. cout << endl;
  41.  
  42. outBalance.open("balance.dat")
  43.  
  44. getch();
  45. return 0;
  46.  
  47. }
Last edited by alc6379; Nov 12th, 2004 at 12:48 pm. Reason: added [code] tags
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: assignment needs a little help, well i do

 
0
  #5
Nov 10th, 2004
Very close, but inBalance is a stream, not an integer. After you open the file, do something like this:
  1. int balance;
  2. inBalance>> balance;
Then use balance and checkAmount for your conditional statements.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 5
Reputation: Intro2Prog is an unknown quantity at this point 
Solved Threads: 0
Intro2Prog Intro2Prog is offline Offline
Newbie Poster

Re: assignment needs a little help, well i do

 
0
  #6
Nov 12th, 2004
can anyonehelp me



  1.  
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int Amount;
  11. int balance;
  12.  
  13. ifstream inAmount;
  14. ofstream outAmount;
  15.  
  16. inAmount.open("balance.dat");
  17.  
  18. inBalance >> balance;
  19.  
  20. if (inBalance.fail())
  21. {
  22. cout << "file balance.dat not found!!!" << endl;
  23. getch();
  24.  
  25. }
  26.  
  27. cout << "Please enter check amount: ";
  28. cin >> Amount;
  29.  
  30. if (balance <=350)
  31. {
  32. cout << "Ok to write check" << endl;
  33. }
  34.  
  35. if (balance >=350)
  36. {
  37. cout << "The bank will not pay this check" << endl;
  38. }
  39.  
  40. cout << endl;
  41.  
  42. outBalance.open("balance.dat")
  43.  
  44. getch();
  45. return 0;
  46.  
  47. }
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 56
Reputation: jasweb2002 is an unknown quantity at this point 
Solved Threads: 2
jasweb2002 jasweb2002 is offline Offline
Junior Poster in Training

Re: assignment needs a little help, well i do

 
0
  #7
Nov 12th, 2004
Whats wrong here? Are you having a problem or do you expect someone to write the program for you?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: assignment needs a little help, well i do

 
0
  #8
Nov 12th, 2004
>can anyonehelp me
I did help you. If you have a new question then ask it. The logic for this program is simple, so either you're very stupid, or very lazy. I prefer to assume the latter, so explain exactly what your problem is and we'll help. But we won't do it for you.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC