Homework 1

Due Date: September 10th, 2021 at 12:00pm


Background

This world is inhabited by small, friendly creatures known as Poke-, sorry, Codémon (please don't sue us). A popular activity for the people (or “coaches”, as they will be referred to from here on out) of this universe is to wander around collecting as many of these Codémon as they can in pocket sized Codéballs, which function as small pocket dimensions. Due to reasons that definitely do not involve making them fight each other, sometimes these poor creatures become injured. When this happens, they will need to be taken to a Codécenter, which can be thought of as a hospital for Codémon. Up until now, these Codécenters charged no price for their healing services.

Codécenters have had it too good for too long. Codécenters are basically the “hospitals” of the Codémon universe, where coaches can give them Codéballs, and they used to heal the Codémon inside at no charge. Corporate greed has taken over the medical industry of the Codémon world, and they’ve decided to start charging exorbitant prices for their healthcare services. You have been hired to develop the software to calculate the prices that coaches must pay in order to heal their little buddies.



Here is how the pricing will breakdown:

Tax Rate

Each region has a different tax value. This tax value must be multiplied by the final price for the final calculation. The region will be the same for ALL customers, so you only need to get this information once for every time your program is run. The regions and tax rates are as follows:

  1. Konta (100% price)
  2. Jahta (80% price)
  3. Hainn (95% price)
  4. Sennah (115% price)
  5. Ynavo (150% price)
  6. Kolas (112% price)
  7. Olalo (75% price)
  8. Golor (250% price)

Insurance

Once a region has been set, you must then be prepared to take in any number of coaches. Each coach may or may not have insurance so you must ask if the coach has insurance. Their insurance rate should then be taken as input from the user as a value (that might have decimals!) between and including 0 and 100. Their final cost will eventually be divided by the insurance rate. Insurance in real life is a little bit more complicated, but let’s keep it simple, huh?

Note: Insurance should be taken from

Cost

Each coach can carry anywhere between 1 to 6 Codéballs with them that they need to get healed. This information must be taken as input from the user.

Once you get this information, you will also need to find out what kind of Codéballs the coach is giving the Codécenter, as different balls have different rates.

The rates are as follows:

  • Codeball - $90
  • Good Ball - $115
  • Extreme Ball - $130
  • Budget Ball - $50
  • Boujee Ball - $350
If you are wondering why these prices are so outrageous look at the picture to the right and see that every Codemon requires a functional Gamecube and TV.

Region Specific Law

Certain regions have certain laws pertaining to what kind of Codéballs are allowed by coaches. Specifically, the budget ball is illegal to use if the coach lives in a region that ends with the letter ‘a’ or ‘o’, and also has a boujee ball in their possession. If you find someone to be breaking the law, inform them of the fact that they are going to be arrested immediately. You do not need to finish calculating their cost. Simply arrest the law-breaking coach, and move on to the next coach, if there are any.

Conversion Rates

Due to a very odd law passed in this universe recently, all calculations must be done using the dollar ($) currency, however, all output must be displayed using the ampersand (&) currency. To convert dollars to ampersands, you must multiply by 11/17 and then add 3.62. Round the final cost up to the nearest penny.

Once the final price has been calculated, give the user the final price charged to the coach, and prompt the user to see if there are any more coaches in the Codécenter. If there are any, repeat this process. If there are no more, give us an exit message and terminate the program.

Precision

Since you want to output the total as a monetary amount, your program will need to display 2 decimal places at all times. Because a total of $3.5 or &3.5 looks weird. To do this we can put the follow code into your program

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

After this code, all floating point output will have exactly 2 figures after the decimal point.

Sample

 
      Welcome to Wong's Fabulous Codecenter Price Gouger Calculator

What region are you using this program from?
1. Konta
2. Jahta
3. Hainn
4. Sennah
5. Ynavo
6. Kolas
7. Olalo
8. Golor
Region: 7

Does the coach have insurance (y/n)? y

What is this coach's insurance rate (0-100)? 50.123

How many codeballs does this coach need healed (1-6)? 3

Which ball?
1. Code Ball
2. Good Ball
3. Extreme Ball
4. Budget Ball
5. Boujee Ball
Ball Type: 3

Which ball?
1. Code Ball
2. Good Ball
3. Extreme Ball
4. Budget Ball
5. Boujee Ball
Ball Type: 2

Which ball?
1. Code Ball
2. Good Ball
3. Extreme Ball
4. Budget Ball
5. Boujee Ball
Ball Type: 1

Total Cost: &6.87

Are there any coaches left (y/n)?
y

Does the coach have insurance (y/n)? y

What is this coach's insurance rate (0-100)? 101

What is this coach's insurance rate (0-100)? 5

How many codeballs does this coach need healed (1-6)? 7

How many codeballs does this coach need healed (1-6)? 5

Which ball?
1. Code Ball
2. Good Ball
3. Extreme Ball
4. Budget Ball
5. Boujee Ball
Ball Type: 4

Which ball?
1. Code Ball
2. Good Ball
3. Extreme Ball
4. Budget Ball
5. Boujee Ball
Ball Type: 5

Authorities have been notified and the client will be arrested shortly

Are there any coaches left (y/n)?
n

Good Bye!

           

Things to remember

Submission Instructions

Submit your assignment to you Githlab repo with your .cpp file. Your program should be able to be complied and executed on the university machines. If your program automatically fails, there will be a chance we won't even grade it.