Site hosted by Angelfire.com: Build your free website today!

 

Program 40

C++ Dzwonkiewicz

Program 40-C++

Use an array of struct or class (an object) that will have information on employees

Also, use a singe object to contain base data (that will be filled by way of a constructor).

Use a member function to print the chart below.

 

All data will be read from a file in GET/SET function( ask me for it, it’s call forty.dat)

Notice that each person will have a name, age, sex, and income in the data file.

Read into your struct array, until out of data, counting the people as you go (Have a max of 10 in your struct array size).

 

The singe struct will be initialized with:

Companyname=Macrosft, taxrate=.001, mfee_minor=10, mfee_adult=50, mfee_senior=5, ffee_minor=15, ffee_adult=75, ffee_senior=0;

 

Chart:

Company Name: Macrosoft

Name                          Age      Sex      Income                        Fee      Tax                  Amount Due

Roland                         25        m         $25000                        $50      $25                  $75.00

Chumley                      44        m         $45000                        $50      $45                  $95.00

Amy Kogel                   15        f           $60000                        $15      $60                  $75.00

Crystal Tobing             67        f           $12000                        $0        $12                  $12.00

Big Greta                     26        f           $63000                        $75      $63                  $138.00

Duncan                        2          m         $10                  $10      $.01                 $10.01

Ken Puduis                  68        m         $88000                        $5        $88                  $93.00

 

Totals: 7 clients                                    $293010          $205    $293.01           $498.01

 

Fee is calculated by age and sex.  The amount is based on Minor:age<21, m=10, f=15

Adult 21<=age<65 m=50, f=75, Senior: age>=65 m=5, f=0

Tax is 0.001 of income

Amount due is tax + fee

Also as the chart shows, get totals at the end of your chart