[SOLVED] Lab #5 - Chapter #3 Functions

15.00 $

Category:

Description

5/5 - (1 vote)
  • Objective: Become familiar with C++ syntax.       Become familiar with writing functions.
  • Overview: This application will interact with the user by inputting workout information and then processing that information and displaying the results to the user.

 

Write a program that will:

 

  • Welcome the User to your app 
  • Prompt the user for the number of steps walked/or ran during a workout (integer) 
  • Prompt the user for their average stride length in inches (double) 
  • Invoke a function called “convertDistance”
    1. Function will have two arguments
      1. Steps walked
      2. Stride Length
    2. Calculate the distance of the workout to miles (1 mile = 63360 inches, define a c++ constant to use this value)
    3. Function will return Distance in Miles a double 
  • Invoke a function called “printWorkout”
    1. Function will have three arguments
      1. Steps walked
      2. Stride Length
  • Distance in miles
  1. Display all the data
    1. Steps walked
    2. Stride Length (display 2 decimals)
  • Miles covered (display 3 decimals)
  1. Function will not return anything 
  • Keeps a running total of distance covered in miles 
  • Keeps the length of the longest workout in miles 
  • Prompt the user to enter another workout 
  • If another workout is to be entered then repeat steps 2 -8. 
  • If no more workouts are to be entered, then
    1. Invoke a function called printWrapUp
      1. Function will have 2 arguments
        • Total in Miles of all Workouts
        • Longest Single Workout
      2. Display the
        • Total in Miles of all workouts
        • longest single workout 
  • Thank the user.

 

Follow good programming and readability guidelines as covered in class.