Question: The objective of this project is to refresh your knowledge of class objects and enums. This will require you to implement a class, Motorcycle, in

The objective of this project is to refresh your knowledge of class objects and enums. This will require you to implement a class, Motorcycle, in addition to its private and public member functions, which will be specified in a further section of this document. You have been given the Motorcycle.hpp file; all that you must do is create and successfully write and compile Motorcycle.cpp.

Description:

Task 1:

Its 10pm and you are on your way to Walmart for your weekly pillaging of necessities: hand sanitizer, toilet paper, Nutella, and the other usuals. On your way there you meet a biker gang, FBK, at a red light. For a brief moment it looks like they are laughing at you, that is until the light turns green and you accelerate to max speed in record time. Suprised, the bikers rides alongside you, offering you a place in their gang. There is one problem, you do not have a motorcycle. Their leader, C.S. Brian, gives you their contact information and you head to your local bike shop the next day. The owner gives you two options:

Implement the following default and parameterized constructors:

Motorcycle(); // brand_ <- a random bike type // curr_acceleration_ <- bike_details::NONE Motorcycle(int kind_of_bike); // initialize all members besides brand_ to the values that // they take on in the default contructor // brand_ <- kind_of_bike 

Hint: Use rand() from the library to produce random values.

Task 2:

Now that you have received your Motorcycle, you want to test its capabilities. Check out how it works! Remember, there is no warranty on your Motorcycle; so if a component doesnt work, its up to you to fix it! You do not want to embarrass yourself on your first day.

Implement following getter functions:

/** return the string that corresponds to the curr_direction_ that the caller faces relative to a cartesian plane; assume that the caller is at position (0,0), the degree measure of (1, 0) is 0 degrees, and the degree measure of (-1, 0) is 180 degrees "North" == 90 0 < "Northeast" < 90 "East" == 0 "Southeast" > 270 "South" == 270 180 < "Southwest" < 270 "West" == 180 90 < "Northwest" < 180 */ std::string getDirection(); string getBikeType(); // string version of brand_ float getSpeed(); // curr_speed_ float getDistanceTraveled(); // distance_traveled_ int getIntensity(); // curr_acceleration_ 

Implement the following public methods:

/** updates direction_ @param degrees: -360 <= degrees <= 360, and if the user enters a number outside of these bounds adjust @param degrees to be within this range */ void turn(float degrees); 

Hint: Use the following visualization to influence your implementation of turn().

Implement the following private method:

/** alters curr_speed_ depending on curr_speed_, curr_acceleration_, and brand_ USE THE FOLLOWING FORMULA: [ (acceleration) / 8 ] + [ (brand) * 17.64 ] */ void updateSpeed(); 

Task 3:

Your Motorcycle works as intended and the FBK are awaiting your arrival. Its time to hit the pavement!

Implement the following public method:

/** if the current acceleration is not HIGH increase it by one level and call updateSpeed() */ void accelerate(); /** if the current acceleration is not NONE decrease it by one level and call updateSpeed() */ void brake(); /** given curr_speed_, curr_acceleration_, brand_, and @param float duration, calculate the distance traveled during the specified time; increment distance_traveled_ by this amount @param float duration: time traveled @return: updated distance_traveled_ */ float ride(float duration);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!