Possible implementation of a bicycle class

Assignment Help English
Reference no: EM131689372

Here is the sample code for a possible implementation of a Bicycle class that illustrates inheritance: 

public class Bicycle {
    // the Bicycle class has
    // three fields
    public int cadence;
    public int gear;
    public int speed;

    // the Bicycle class has
    // one constructor
public Bicycle(int startCadence,
                   int startSpeed,
                   int startGear) {
        gear = startGear;
        cadence = startCadence;
        speed = startSpeed;
    }
        
    // the Bicycle class has
    // four methods
    public void setCadence(int newValue) {
        cadence = newValue;
    }
        
    public void setGear(int newValue) {
        gear = newValue;
    }
        
    public void applyBrake(int decrement) {
        speed -= decrement;
    }
        
    public void speedUp(int increment) {
        speed += increment;
    }

        
    // the Bicycle class has
    // three fields
    public int cadence;
    public int gear;
    public int speed;
        
    // the Bicycle class has
    // one constructor
    public Bicycle(int startCadence,
                   int startSpeed,
                   int startGear) {
        gear = startGear;
        cadence = startCadence;
        speed = startSpeed;
    }
        
    // the Bicycle class has
    // four methods
    public void setCadence(int newValue) {
        cadence = newValue;
    }
        
    public void setGear(int newValue) {
        gear = newValue;
    }
        
    public void applyBrake(int decrement) {
        speed -= decrement;
    }
        
    public void speedUp(int increment) {
        speed += increment;
    }
        
}

Discuss with your classmates an example of an object or concept where the concept of inheritance can be utilized. Describe what can be used as the fields, constructor and methods.  Address these questions during your discussion, and think of other questions to ask your classmates.

Hi Ashish, This is me again. So this one is just a discussion. Every week we write something on the discussion board according to the teacher's format. And this one is today's discussion topic. Let me know if you have any question.

Reference no: EM131689372

Questions Cloud

Write about way ios is better than android : Write about way IOS is better than android. Discuss the things that you know about it and why you find it so interesting.
Analysis of a proposed new security project : What are the four main areas of investigation that you will need to address, and for each one, list two questions that the study will need to answer.
Negotiate a contract with a managed security services : You have been assigned to negotiate a contract with a managed security services (MSS) provider to outsource some of your company's security operations.
What about company self-concept : Why is it important for firms to address the question of their public image even without public agitation or scandal? What about company self-concept?
Possible implementation of a bicycle class : Here is the sample code for a possible implementation of a Bicycle class that illustrates inheritance:
Evaluate the companys external environment : Determine how to create value and sustain competitive advantage using the environmental scanning strategy.
What is the probability that the sample have a mean return : Mutual funds reported strong earnings in the first quarter of 2006. Especially strong growth occurred in mutual funds consisting of companies focusing on Latin.
Knowledge regarding how to make their computers secure : Security experts agree that average home computer users have very little knowledge regarding how to make their computers secure.
Requisite permission from the appropriate people : You can also use traditional firms if you can get the requisite permission from the appropriate people.

Reviews

Write a Review

English Questions & Answers

  Write a profile

Write a profile on bishop poleni.

  Education system

Write a rearch paper on education system

  Write an report

The U.S. President Barack Obama said America can "win the future" by rebuilding its manufacturing sector (on June 8, 2011, after visiting an automotive training center at a community college in Virginia, outside Washington). Do you agree, and why?

  Discuss the accuracy of this statement

'Consideration does not have to be adequate or commercially realistic, nor does it need to be expressed in monetary terms, it merely needs to be "sufficient".' Discuss the accuracy of this statement.

  Write an essay on the youngest billionaire

Write an essay on the youngest billionaire

  Transformational leadership in the public sector

The more hierarchical an organization's authority structure, the lower the reported practice of transformational leadership behaviors.

  Modal verbs or modal constructions

Identify all the modal verbs or modal constructions in the passage

  Write a latter to mom thanking to adopting and caring

Write a latter to mom thanking for adopting and caring,

  Ways of knowing & authority in your discipline

To explore and become familiar with your discipline; to prepare you for your major researched essay.

  Writing an effective business letter

Prepare a letter in either block or modified block format, addressed to your employer or supervisor and copied to your marker.

  Discuss the kingdom of saudi arabia

Discuss the Kingdom of Saudi Arabia

  Developing an annotated bibliography

Developing an annotated bibliography

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd