Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Programming: For this task we will create a class with some functions that will support our class which holds the annual income and

In C++ Programming:

For this task we will create a class with some functions that will support our

class which holds the annual income and tax rate for from 1 to many tax

payers. We will also compute each payers amount of taxes that are due for

the year. The amount is calculated by taking each payers income, multiply it

by the tax rate, yielding their taxes ( taxes = income * taxRate ).

So here is a decomposition of what is to be done for this task:

Define a class called TaxPayer that contains the tax payer information:

the tax rate, the income, and the taxes (all floats).

The taskE driver will create a dynamic array for these objects, called

citizen, using SIZE again as the size for the allocation. Notice how the

constructor works for arrays of objects.

Create a function called taxTaker that will accept a pointer to the array

of objects as a parameter. This function will take (actually, it will be

generated via the random function) user information for each payer,

up to the size of the array of structures. The function should create a

randomly generated income value between 5000.00 and 50000.00,

and another randomly generated tax rate between 0.01 through 9.9,

populate the object with those values and then store the computation

in the taxes element. Use rand() and properly seed... This function

should also use standard input validation and make sure it falls with

the range of, and income amounts are otherwise valid numbers.

Create a function called taxPrint that will accept a pointer to the array

of objects as a parameter input and print out the total taxes due for all

the payers in the array to standard output. The tax payer ID should be

the subscript values. Make sure you format the output and print for

each payer, up to the size.

This code is used:

// PLACE ALL OF THIS PROGRAM'S prototypes and Declarations here and comment your code.

// PLACE prototypes and Declarations HERE FOR TASK E // *************************************************

void taskE() {

TaxPayer *citizens = new TaxPayer[SIZE]; taxTaker(citizens); taxPrint(citizens);

cout << "end of task E" << endl; cin.get(); }

// PLACE CODE HERE FOR TASK E // ************************************************* // TASK E CODE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions