Question: CIS 2 1 4 , Week 3 , Fun with OOP and Bicycles As your first chance to explore the wonderful world of object -

CIS 214, Week 3, Fun with OOP and Bicycles
As your first chance to explore the wonderful world of object-oriented programming, I
thought this would be a good time to play with a bicycle. Everyone likes bicycles -
except Calvin of course.
This week you are going to create a Bicycle class that can be used to create a digital
bicycle.
Were going to strip off all the non-essential components (brakes, for example) and
focus on the things that make the bicycle go (faster). If youre wondering where the idea
for this project came from, in grade school I was the smallest, skinniest, slowest kid in
my class. But I was the only one who owned a three-speed Schwinn and you let me
crank the pedals three times and no one could catch me. So were going to build a
bicycle with a focus on speed.
Your Bicycle class will have the following attributes (and no more).
Gears (1 through 3)
Cadence (1 rpm through 100 rpm). In cycling, cadence is the rate at which a cyclist is
turning the pedals.
Speed (in miles per hour)
Your Bicycle class will have the following behaviors (and no more).
The rider will be able to enter gear settings between 1 and 3.
The rider will be able to enter a cadence between 1 and 100.
Given a gear setting and cadence, the Bicycle will be able to calculate its speed in miles
per hour and output that result.
Rules for calculating MPH in various gear settings
First gear MPH = cadence /13
Second gear MPH = cadence /7
Third gear MPH = cadence /3
You will create a Bicycle class (Bicycle.java) that follows the specification above. Then
you will create an application to test the Bicycle class (BicycleTest.java). The application
will instantiate a Bicycle object, then permit the rider to enter a cadence and gear
setting. The rider will be prompted to enter a cadence between 1 and 100 and a gear
setting between 1 and 3. Once the cadence and gear setting have been entered, the
application will output the bicycles speed.
Class members will be declared public and private as appropriate.

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 Programming Questions!