I don't get how to start. I just need a starting point and then i can get the rest maybe a hint on where to start I don't want people to do the coding for me I just need a hint.
Write a program that will allow a user to enter the weight of a skier in lbs, the slope of the run in degrees, and the time since the skier started down the slope. The program will display the skier's speed and terminal velocity in MPH. You will need to write code to convert pounds to kilograms. 1 lb = 0.45359237 kg.
Functions are provided in the starter program file for all other calculations and conversions.
Sample output:
Enter the weight of the skier in lbs: 200
Enter the slope of the ski run in degrees: 30
Enter the number of seconds the skier has been moving down the slope: 10
The skier's terminal velocity is 53.6864 MPH
The skier's speed is 49.0369 MPH
Here is the coding I have so far:
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;
/* Constants */
const float G = 9.80665; // acceleration of gravity
const float AR = 0.75; // frontal area in square meters
const float FK = 0.14; // constant of kinetic friction for ski on snow
const float PI = 3.14159265;
const float kilo_convert = 0.45359237;
/* Prototypes */
float acceleration(float angle, float friction);
// returns acceleration in meters per second
// parameters: angle in radians, friction constant
float terminalVelocity(float mass, float accel, float area);
// returns terminal velocity in meters per second
// parameters: mass of skier in kg, acceleration in meters per second squared,
// frontal area of skier in square meters.
float velocity(float time, float vt, float accel);
// returns miles per hour
// parameter: speed in meters per second
float velocity(int t, float theta, float m, float area, float fk);
// returns speed in meters per second
// parameters: time in seconds, terminal velocity in meters per second,
// acceleration in meters per second squared
float mpsToMph(float mps);
// returns miles per hour
// parameter: meters per second
float degToRad(float deg);
// returns angle in radians
// parameter: angle in degrees
float changeSlope(float& theta);
// returns an angle in degrees
// parameter: angle in radians
//******************************
// instructions
//******************************
void instructions ()
{
cout << "\tInstructions:" << endl;
cout << "\tThis program calculates skier's speed and terminal velocity in MPH." << endl;
cout << "\tYou the user will be asked to enter your weight, slope of the run" << endl;
cout << "\t,the time it took from when you started to the point of stoping." << endl << endl;
}
//*****************************************
// kilo_convert
//*****************************************
float kiloConvert()
{
int Pounds = Pounds * kilo_convert;
cout << "\tEnter the weight of the skier in lbs:" << endl;
cin >> Pounds;
}
int main()
{
instructions();
/* Test Drivers */
//cout << "Acceleration on snow with a 45 degree slope." << endl;
//cout << "Expect 5.96 meters per second squared" << endl;
//cout << "Ouput of function: " << acceleration(PI / 4, FK) << endl;
//cout << endl;
//cout << "Speed after 5 seconds with parameters from above." << endl;
//cout << "Expect 22.57 meters per second" << endl;
//cout << "Output of function: " << velocity(5.0f, 29.43F, 5.96F) << endl;
//cout << endl;
//cout << "Overloaded Velocity. Uses the same parameters as the tests above." << endl;
//cout << "Expect 22.57 meters per second" << endl;
//cout << "Output of function: " << velocity(5, PI / 4, 100.0F, AR, FK ) << endl;
//cout << endl;
// Add your own test drivers for the rest of the functions
return 0;
}
/* Function definitions */
float acceleration(float angle, float friction)
{
return G * (sin(angle) - friction * cos(angle));
}
float velocity(float time, float vt, float accel)
{
return vt * tanh(accel * time / vt);
}
float terminalVelocity(float mass, float accel, float area)
{
const float CD = 1.2; // constant of drag. For skier: range is 1.1 to 1.3
const float RHO = 1.3; // fluid density of air in kg / cu meter
float velocity(int t, float theta, float m, float area, float fk)
{
// Add your own code here
// This function will call acceleration, terminalVelocity and velocity
return 0.0F;
}
float changeSlope(float& theta)
{
// Add your own code here
// This function will randomly change the angle of the ski slope
// to simulate the bumps and variations in a real ski slope
return 0.0F;
}