fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. //Jay Greene//
  6.  
  7. int main() {
  8. int credHour ;
  9. int studyHour;
  10. int shouldStudy;
  11. int actStudy;
  12. // User inputs amount of hours to be calculated//
  13. cin >> credHour;
  14. // The formula to calculate how many hours one should be studying for every credit hour inputed by the user"
  15. studyHour = ( credHour * 3 );
  16. // Prints out how many hours one shoud study //
  17. cout << "Total Hours is : " << studyHour << endl;
  18.  
  19. // Prompts the user to enter the amount of hours they should study //
  20. cin >> shouldStudy;
  21. // Calculation of how many hours the user is actually spending //
  22. actStudy = (studyHour - shouldStudy);
  23. //Prints how many hours spent studying //
  24. cout << "Hours actually spent studying is : " << actStudy << endl;
  25.  
  26.  
  27. //Dimensions for the stadium used for the conversion //
  28. int stadium1 = 105 ;
  29. int stadium2 = 68 ;
  30. // The calculations for the stadiums to be converted from meters to feet//
  31. stadium1 = 105 * 3.281;
  32. stadium2 = 68 * 3.281;
  33. //Prints the length and width of the stadium using the values given//
  34. cout << "The length and width of the stadium is : " << stadium1 << " ft" << endl;
  35. cout << "And : " << stadium2 << " ft "<< endl;
  36.  
  37. // Ball size circumfrence calculation//
  38. double ballSize = 2* M_PI*(11);
  39. // prints the ball size//
  40. cout << " The circumfrence of the ball is " << ballSize << "cm^3 " << endl;
  41.  
  42. // Prompts the user to enter the amount of stadium players //
  43. int stadiumP ;
  44. double totalMin ;
  45. cin >> stadiumP;
  46. // Calculations of the amount of time players can play //
  47. totalMin = 43.0 / stadiumP;
  48. cout << "Players will play for " <<totalMin <<" minutes"<< endl;
  49.  
  50.  
  51.  
  52. return 0;
  53. }
Success #stdin #stdout 0s 4280KB
stdin
15
30
23
stdout
Total Hours is : 45
Hours actually spent studying is :  15
The length and width of the stadium is : 344 ft
And : 223 ft 
 The circumfrence of the ball is 69.115cm^3 
Players will play for 1.86957 minutes