Thread: I need help!!! Anyone good w/Loops

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    Question I need help!!! Anyone good w/Loops

    have midterms tomorrow and I cannot get this to work out. I will have an example like this on my test and I've tried all night. I need a C++ whiz!!! This is the problem.

    The Early Raildroad Corporation pays an annual bonus as part of its profit sharing plan. This year all employees who have been with the company for 10 years or more receive a bonus of 12 percent of thier annual salary, and those who have worked at Early from 5 through 9 years will receive a bonus of 5.75 percent. Those who have been with the company less than 5 yrs receive no bonus.

    Ask for the employee ID number, the employees annual salary, and the number of years employed with the company, then find and print the bonus. All bonuses should be rounded to the nearest dollar. Use a loop to allow for more that one employee. Use a cout to ask if there is another employee to be entered and a cin (y/n) and continue looping if (y). Keep a total of bonus paid. Output should be in the following form:

    EARLY RETIREMENT CORP.
    Employee ID:
    Years of Service:
    Bouns Earned:
    If you have any advice please e-mail me at [email protected]
    I will owe you my life!!!!


  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    You will find it very tough to find someone here that will do you homework for you... that is of course if you ever read this...
    Blue

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    64
    Come on man, this is basic c++, read a turtorial and it should only take you a short time, you'll never get anywhere asking people to do it for you. if your midterms are tommorrow and it involves c++ what the hell have you been doing the whole year.
    Read a tutorial there all over the net and i think theres a few in here, it will only take you about 30 minutes after that.

  4. #4
    asimos
    Guest
    heheh
    even i know this

    i mean this is very basic

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Okay guys, I think he will have got the message by now...
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    My advice is don't start your projects on the last day.

    In addition, you could have read the
    Read this first... post in the forum.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  7. #7
    Registered User
    Join Date
    Feb 2002
    Posts
    12
    As mentioned, here, no one will do ur homework;but this will show you the line, and to be honest, it is very basic:


    #include <iostream.h>

    class Cbonus
    {
    double anual, bonus;
    int year;
    public:
    Cbonus getData(void);
    double calcualteBonus(Cbonus);
    };

    Cbonus Cbonus::getData(void){
    Cbonus bonus;
    cout <<"Anual: ";
    cin>>bonus.anual;
    cout <<"years: ";
    cin>>bonus.year;
    return bonus;
    }
    double Cbonus::calcualteBonus(Cbonus myBonus)
    {
    double x;
    if (myBonus.year>=10)
    {
    x=(myBonus.anual*12)/100;
    }

    if ((myBonus.year>5)&&(myBonus.year<9))
    {
    x=(myBonus.anual*5.75)/100;
    }
    if (myBonus.year<5)
    {x=0;}

    return x;
    }


    int main()
    {
    Cbonus myBonus;
    double bonus;
    myBonus=myBonus.getData();
    bonus=myBonus.calcualteBonus(myBonus);
    cout<<"\nBonus is:"<<bonus<<"\n";
    return 0;
    }


    HTH
    Nima Ranjbar

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In a game Engine...
    By Shamino in forum Game Programming
    Replies: 28
    Last Post: 02-19-2006, 11:30 AM
  2. Good books for learning WIN32 API
    By Junior89 in forum Windows Programming
    Replies: 6
    Last Post: 01-05-2006, 05:38 PM
  3. Good resources for maths and electronics
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-22-2004, 04:23 PM
  4. what is good for gaphics in dos
    By datainjector in forum Game Programming
    Replies: 2
    Last Post: 07-15-2002, 03:48 PM
  5. i need links to good windows tuts...
    By Jackmar in forum Windows Programming
    Replies: 3
    Last Post: 05-18-2002, 11:16 PM