Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program using a vector of structures. This program uses a vector of structs to take tax info. from two citizens and yield their tax

C++ program using a vector of structures.

This program uses a vector of structs to take tax info. from two citizens and yield their tax results for the year. I think I'm close but I'm getting errors. Here is what I have so far. Instead of

rewriting the program from scratch, please try to fix the code below. Thanks.

(Lines 1-50)

image text in transcribed

(Lines 50-90)

image text in transcribed

(Code to paste)

#include #include #include

using std::cin; using std::cout; using std::endl; using std::vector;

const int SIZE = 2; void taxPrint(citizen); //prototypes void taxTaker(citizen);

struct taxPayer { float taxRate; float income; float taxes; };

int main() { std::cout citizen; //vector of type struct taxTaker(citizen); //two functs pass citizen vector taxPrint(citizen); return 0; }

void taxTaker(vector) //funct that gathers info. { struct taxPayer payer; bool controlFlag1 = true; bool controlFlag2 = true;

for (int i = 1; i

std::cout > payer.income;

if ((cin.fail()) || payer.income ::max(), ' '); } else { controlFlag1 = false; }

} while (controlFlag1);

std::cout > payer.taxRate;

if ((cin.fail()) || (payer.taxRate 9.9)) //tax rate validation { cout ::max(), ' '); } else { controlFlag2 = false; }

} while (controlFlag2);

payer.taxes = (payer.income * payer.taxRate)/100 citizen.push_back(payer);

}

}

void taxPrint(vector) //print funct { std::cout

for (int j = 1; j finclude #include limits sing std::endi: 10 11void taxPrint cicizen): const int SIZE-2; 13 17 float income 21 std::cout : :n .x(), ' '}; 51 contr01 Flag 1 = false 53 while (controlFlag1); 56 std ! !cont

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 Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

6-5. Why are subject lines important in email messages? [LO-4]

Answered: 1 week ago

Question

6-7. Why do blogs make an ideal social media hub? [LO-6]

Answered: 1 week ago