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

  Summarize the given article

The Contemporary Reality of an International Human Rights Challenge - Summarize the article

  How do organizations create opportunitiy for illegal conduct

How do organizations create opportunities for illegal conduct?Identify the external factors that impact corporate crime. Describe Karl Marx's theory of crime as it relates to white collar crime. Discuss the limitations of the Marxist theory.

  Write a paper about pine tree by the rice paddy

Write a paper about "Pine Tree by the Rice Paddy".

  How understanding conceptual model of working memory help

Explain how understanding the conceptual model of working memory helps you in selecting strategies to take in helping a child that may have a communicative disorder.

  Time traveling art historian book chaptersyou are a

time traveling art historian book chaptersyou are a world-renowned art historian and author with the ability to time

  Explain how the concept of holiness emerges in the dialogue

in the euthyphro socrates and euthyphro discuss the concept of pietyholiness. this essay will not only test your

  How does the placement of words and line breaks contribute

How does the placement of words and line breaks contribute to the meaning or experience of Joy Harjo's "White Bear" poem?

  What do enkidus curse

What do Enkidus curse and then his blessing of the prostitute suggest about the lot of women in ancient Mesopotamia?

  The purpose of a rough draft

The purpose of a rough draft is to provide raw material for you to revise. A draft may be compared to the ingredients for my spaghetti. Once your rough draft is completed you can organize it by grouping ideas together under subtopics. I organize the ..

  Explain how literature can give a reflection of life which

discuss how literature can provide a reflection of life which can help us understand our own struggles triumphs values

  Pick three stride threats

Pick three STRIDE threats and explain tactics used to mitigate them. You can use some examples from recent attacks or from your professional experience.

  Identify two factors that would cause the demand curve

Discuss whether or not demand and supply are in equilibrium or is demand greater than supply.

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