fork download
  1. #include <iostream>
  2. #include <cmath> // Library needed for pi value.
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. // Program by Mubeen Quadrt, ECGR 2103-002, ICA 4
  8. // Below are variables used for Questions 1 through 3
  9. int numHours;
  10. int studyTime;
  11. int actualStudyTime;
  12. int timeDiff;
  13. double stadiumDim1Feet;
  14. double stadiumDim2Feet;
  15. double circumferenceBall;
  16. double sizeFiveRadius = 11.0; // Initalized Radius value
  17. double numPlayers;
  18. double minutesPlayed;
  19.  
  20. // Question 1 Below
  21. cout << "How many credit hours are you taking this semester?" << endl; // Output asking question to user to enter how many hours they are taking.
  22. cin >> numHours; // User input for amount of hours you are taking this semester
  23. studyTime = numHours * 3; // Calculation for determining how much time you should spend studying
  24. cout << "Based on the number of hours you are taking you should spend " << studyTime << " hours studying." << endl; // Outputs the amount of a time a user should spend studying
  25.  
  26. // Question 2 Below
  27. cout << "How many hours do you actually spend studying?" << endl; // Outputs question to user
  28. cin >> actualStudyTime; // User input response to question
  29. timeDiff = studyTime - actualStudyTime; // Calculation for difference between the amount of time you should spend studying time you actually study.
  30. cout << "The difference in the number of hours between the time you should spend studying and do study is " << timeDiff << " hours." << endl; // Output statment for time difference.
  31.  
  32. // Question 3 Below
  33. stadiumDim1Feet = 105 * 3.28; // Calculation for meters to feet for the first dimension of the stadium
  34. stadiumDim2Feet = 68 * 3.28; // Calculation for meters to feet for the second dimension of the stadium
  35. circumferenceBall = 2 * M_PI * sizeFiveRadius; // Calculation for circumference of size 5 ball, which radius is equal to 11
  36. cout << "The correct circumference for a size 5 ball is " << circumferenceBall << " cm." << endl; // Output for circumference of size 5 ball
  37. cin >> numPlayers; // User input for the number of players.
  38. minutesPlayed = (22 / numPlayers) * 90; // Amount of minutes each player will play if everyone had a chance to play (Field allows for 22 players, games run for 90 minutes which is where my calucation is based off of.)
  39. cout << "If everyone had a chance to play the number of minutes eacher player would play is " << minutesPlayed << " minutes." << endl; // Output statment for the amount of minutes each player will play if everyone had a chance.
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 4176KB
stdin
12
24
24
stdout
How many credit hours are you taking this semester?
Based on the number of hours you are taking you should spend 36 hours studying.
How many hours do you actually spend studying?
The difference in the number of hours between the time you should spend studying and do study is 12 hours.
The correct circumference for a size 5 ball is 69.115 cm.
If everyone had a chance to play the number of minutes eacher player would play is 82.5 minutes.