Question: C++ - Write a program that simulates time passing until a company amasses more than 10 billion dollars in cash. 1. Receive the names of

C++ - Write a program that simulates time passing until a company amasses more than 10 billion dollars in cash.

1. Receive the names of companies as command line arguments. The names of the companies will not contain whitespace characters.

2. Maintain information about each corporation in an object that contains at least:

The corporation's cash (initially $0)

The corporation's yearly taxable income (initially $1 billion)

The corporation's yearly sheltered income (initially $0)

3.

Process an arbitrary number of commands as input through stdin. Each command consists of one or three whitespace-delimited tokens. The commands to be coded are:

taxable name value: Assigns a new amount of annual taxable income for the given corporation. name must be a valid name of a company, and value must be a decimal number in the range provided by a double. Example:

taxable Microsoft 10e9

sheltered name value: Assigns a new amount of annual sheltered income for the given corporation. name must be a valid name of a company and value must be a decimal number in the range provided by C++'s double type. Example:

sheltered Target 3e9

year: Simulates the passing of one year by adding to every corporation's cash the sum of its current taxable annual income (minus the corporate tax rate of 21%) and tax-sheltered annual income.

4. Once any company achieves more than $10 billion cash (to double precision), print a line to standard output containing the name of each company to do so in the same order as specified in the command-line arguments. The program shall then exit.

Use this struct for each company object:

struct Company { std::string name; double cash = 0; double taxable_income = 1e9; double sheltered = 0; };

Please write this in C++ and if possible, explain in detail how to process the command line arguments. Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!