CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2011
    Posts
    2

    Unhappy Simple Bank Code Problem

    Hi Everyone

    I've just started a C++ programming class and I need to write a program to total up one day's worth of bank activity with a small percentage, but I don't know where to even start. Here's the problem summary:

    The Silly Savings and Loan Company just opened up with a cash balance of $1000, and a plan to get rich. Their plan to make money is simple. They will charge no fee for checks, and a 3% fee for all deposits. You will write a program for them. They will run your program and enter deposits as positive numbers, and checks as negative numbers. All transactions will be recorded in the order they happen. When they run out of things to enter at the end of the day, they will enter a value of 0 to stop the program.

    The program needs to add up both sets of numbers (deposits and checks) and figure out the amount of cash they should have at the end of the day. For every deposit, the 3% fee will be removed from the amount actually deposited, that amount will be added in to the profit they expect to make.

    Once the data entry has been completed, the program will print out the total amount of checks written (as a positive number), the total amount of deposits received, the amount of cash they should have on hand, and the total profit earned that day.

    Here are the transactions for their first day of operation:
    Deposit 100.00
    Check 500.00
    Deposit 250.00
    Deposit 25.00
    Check 75.50
    Deposit 27.50
    Check 775.27

    I started some code with the help of a friend, but I don't think it is correct. Can someone help me?
    Here is was I had written before, thought I don't really understand what I have done.

    #include <cstdlib>
    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    double 0.0;
    double fee;
    double checks;
    double deposits;
    double balance;
    double balance = balance + checks+ deposists;
    cout << "balance: ";
    cin >> checks, depsits
    system("PAUSE");
    return 0;
    }


    Please! Any help would be greatly appreciated

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Simple Bank Code Problem

    [ removed duplicate thread ]

    Do not start multiple threads about the same issue.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Simple Bank Code Problem

    Quote Originally Posted by sarita.stuff@hotmail.com View Post
    ...
    I started some code with the help of a friend, but I don't think it is correct. Can someone help me?
    Here is was I had written before, thought I don't really understand what I have done.

    #include <cstdlib>
    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    double 0.0;
    double fee;
    double checks;
    double deposits;
    double balance;
    double balance = balance + checks+ deposists;
    cout << "balance: ";
    cin >> checks, depsits
    system("PAUSE");
    return 0;
    }
    1. Well, did you try to compile this code?
    2. What let you doubt "it is correct"? Have you got wrong result using this code?
    Victor Nijegorodov

  4. #4
    Join Date
    Sep 2011
    Posts
    2

    Re: Simple Bank Code Problem

    Quote Originally Posted by Marc G View Post
    [ removed duplicate thread ]

    Do not start multiple threads about the same issue.
    Hi Marc G, sorry about the double post! I thought I lost the first one and I couldn't find it so I made another. I'm still getting lost trying to navigate through the site, but thank you!

  5. #5
    Join Date
    Sep 2011
    Posts
    2

    Re: Simple Bank Code Problem

    Quote Originally Posted by VictorN View Post
    1. Well, did you try to compile this code?
    2. What let you doubt "it is correct"? Have you got wrong result using this code?
    Yes it gave me an error message. I realize now that I misspelled some words but the code still isn't quite working.

    I'm trying to use the starting balance, add deposits, and subtract checks in order, take 3% of all the deposits and add it to the daily profit, then finally total up how much money the bank has at the end of the day.

    When I solved the problem on paper, the end total came out to around $65.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Simple Bank Code Problem

    One thing that will help you is to input values into your variables before you do the calculations with them.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured