Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask English Expert

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.

English, Academics

  • Category:- English
  • Reference No.:- M92498069
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in English

Question my topic is parenting1what is your topic and

Question: My topic is Parenting 1. What is your topic and position? 2. Identify one source that agrees with your position and one that disagrees. • Include a link to each source if possible. 3. In your sources, what is o ...

Preludes to jesuss ministry 1 read luke 11-338 in noab as

Preludes to Jesus's Ministry 1. Read Luke 1:1-3:38 in NOAB. As you go through, make a bullet-point list for each of the following. You do not need to use complete sentences for these lists: a. Identify major indicators o ...

Summary of steps your basically reading and adding on to

Summary of Steps ( your basically reading and adding on to the attached documents below) Research two additional IS-related solutions that you listed in your document during Module 3. Edit your research paper document ba ...

Argumentative research essaybackground- you have completed

Argumentative Research Essay Background: - You have completed research on August Wilson, his life, and his plays Prompt (what will you be writing about): - Is Fences an accurate depiction of the African American communit ...

This is going to be a post on a blog for my class please be

This is going to be a post on a Blog for my class. Please be creative. Pictures and are okay to use. Not too short but not too long so it's not too boring to read. Fight for Freedom. Consider Douglass's speech "What to t ...

Book assigned for reviewbaylis d 2013 the traveller notes

Book Assigned for Review Baylis, D. (2013). The Traveller: Notes from an Imperfect Journey Around the World. Sparks Publishing. Task: In this assignment, you are to write a review of a chapter of the assigned non-academi ...

Did you know that by improving your effective listening

Did you know that by improving your effective listening skills you will become a more influential and powerful conversationalist? Did you know that the better your writing skills are, the better the impression you'll mak ...

Everyone is motivated by different things and in different

Everyone is motivated by different things and in different ways. Some need intrinsic motivation while others thrive on extrinsic motivation. Below is a YouTube video (01:32) on Intrinsic and Extrinsic motivation. Discuss ...

According to the biography in your textbook the norton

According to the biography in your textbook (The Norton Anthology American Literature, Beginnings to 1865) , Paul Laurence Dunbar wanted "to interpret my own people through song and story, and prove to the many that we a ...

Question blog project 1 my favorite films and genre

Question: Blog Project #1 "My Favorite Films and Genre Conventions" Part 1: Blog Post (media image with target 250 words) -- DUE BY 11:59 PM (SD TIME) SUNDAY, SEPTEMBER 30th Objective: Your objective with this Blog proje ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As