Please help me to finish this. It should be easy, but I have no idea. Thank you
ID: 3676854 • Letter: P
Question
Please help me to finish this. It should be easy, but I have no idea.
Thank you very much!
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
// Some CONSTANTS you may find useful.
const double PI = atan(1.0)*4;
const double FEET_PER_MILE = 5280;
const double INCHES_PER_FOOT = 12;
const double INCHES_PER_MILE = FEET_PER_MILE*INCHES_PER_FOOT;
const double MINUTES_PER_HOUR = 60;
const double SECONDS_PER_MINUTE = 60;
const double DEFAULT_TIRE_SIZE = 15;
class Wheel {
public:
// Set the speed and rpms to zero and the radius to DEFAULT_TIRE_SIZE
Wheel(){
double speed = 0.0;
double rpms = 0.0;
double radius = DEFAULT_TIRE_SIZE:
}
// Set the speed and rpms to zero and the radius to in_radius
Wheel(double in_radius){
double speed = 0.0;
double rpms = 0.0;
double radius = in_radius;
}
// set the wheel radius and a vehicle speed in MPH.
// Calculate the RPM based on speed and radius
Wheel(double in_radius, double in_speed){
// FILL IN
}
// Set the RPM and update the speed
// We have count revolution in a certain interval of time
// seconds
void setRPM(double in_revolutions, double in_time){
// FILL IN
}
// Set a new speed and update the RPM
void setSpeed(double in_speed){
// FILL IN
}
double getRadius(){
// FILL IN
}
double getDiameter(){
// FILL IN
}
double getCircumference(){
// FILL IN
}
double getSurfaceArea(){
// FILL IN
}
double getSpeed(){
// FILL IN
}
double getRPM(){
// FILL IN
}
// Display the Wheel Parameters
void displayParameters(){
cout << "Wheel Radius: " << radius << endl;
cout << "Speed: " << speed << " MPH" << endl;
cout << "Wheel Circumference: " << getCircumference() << " inches" << endl;
cout << "Wheel Spin Rate: " << rpm << " RPM" << endl;
}
private:
double radius; // radius inches
double speed; // MPH
double rpm; // RPM
};
Explanation / Answer
RPM formula = linear distance traveled divided by linear distance per wheel RPM.
Find the diameter (d) of the wheel by multiplying the radius (r) by two: 2 * r = d.
Find the circumference (C) of the wheel by multiplying the diameter by pi, which is approximately 3.14159: d * pi = C.
Multiply C by the rpm to get the velocity (v) in units per minute. For example, if the value of C is in inches, v will be in inches per minute: C * rpm = v.
If desired, convert v from inches per minute to miles per hour by multiplying by 60/63,360, or 0.00095.
Wheel(double in_radius, double in_speed){
double distance=2*in_radius;
double circumference=PI*distance;
}
void setRPM(double in_revolutions, double in_time){
double velocity=circumference*RPM;
}
void setSpeed(double in_speed){
System.out.println("in_speed");
}
double getRadius(){
double radius=in_radius;
System.out.println("radius");
}
double getDiameter(){
double diameter=2*in_radius;
System.out.println("diameter");
}
double getCircumference(){
double circum=PI*distance;
System.out.println("circumference");
}
double getSurfaceArea(){
double sa=2*PI*in_radius;
System.out.println("surface area");
}
double getSpeed(){
double speed=distance/MINUTES_PER_HOUR;
cout << "Speed: " << speed << " MPH" << endl;
}
double getRPM(){
cout << "Wheel Circumference: " << getCircumference() << " inches" << endl;
cout << "Wheel Spin Rate: " << rpm << " RPM" << endl;
}
}
NOTE:-I have written the diaply messages in java just convert into c++