Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type) and calculates actual game time
C++
Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type) and calculates actual game time (double) based on the following conditions: if the number of players or the expected game time is less than or equal to ZERO, it should output Wrong input if the number of players is greater than 0 and less than or equal to 6 and if they are on the 'R' or 'r' team, their game time will be 10% faster and if they are on the 'B' or 'b' team, their game time will be 15% faster and if they are on the 'Y' or 'y' team, their game time will be 20% faster and if they are on any other team, they will play 096 faster . If the number of players is greater than 6 but less than or equal to 12 and if they are on the 'R' or and if they are on the 'B' or 'b' team, their game time will be 25% faster and if they are on the 'Y, or y team their game time will be 30% faster and if they are on any other team, they will play 0% faster team, their game time will be 20% faster If the number of players is greater than 12 but less than or equal to 18 . and if they are on the 'R' or 'r' team, their game time will be 30% faster and if they are on the 'B' or 'b' team, their game time will be 35% faster and if they are on the 'Y' or y team, their game time will be 40% faster and if they are on any other team, they will play 096 faster If the amount of players is greater than 18, it should output Too many players . Your program should output the total time played in minutes with only two digits following the decimal point. Even though minutes will be fractionalized, you will not have to convert to seconds but will be expected to understand the conversion regardless (ie. 1.50 minutes =-1 minutes and 30 seconds). You have to use both if and else statements to write your code Formula for calculating actual game time Formula for calculating actual game time: actual_time -expected_time expected_time reduction_percentage/100) Hint: In order to print a double up to only two decimal places, include the library iomanip and use the following syntax cout stands for amount of players 40 ->stands for expected game time in minutes r-stands for team Sample Output 1: 32.00 minutes Sample Input 2: 0 10 b Sample Output 2: Wrong input Sample Input 3: 19 50 b Sample Output 3: Too many players Sample Input 4: 18 50 e Sample Output 4: 50.00 minutes Sample Input 5: 18 50B Sample Output 5: 32.50 minutes Sample Input 6: 18 50 b Sample Output 6: 32.50 minutes Sample Input 7: 18 -10 b Sample Output 7 Wrong InputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started