Results 1 to 3 of 3
  1. #1
    Dai
    Dai is offline Member
    Join Date
    Sep 2013
    Posts
    15
    Rep Power
    0

    Default Please help me to understand this question!

    Hello everyone,

    I'm new in java and I have a assignment and I have some questions: Under “Interfaces and Inheritance in Java”, studied about a concept called Polymorphism. How does the Bicycle-MountainBike-RoadBike example shown under the link http://docs.oracle.com/javase/tutori...sm.html” exemplifies polymorphism. Extend the MountainBike class to create another class called DownhillMountainBike. Downhill bikes are a specialised type of mountain bike with a very strong frame, much stronger than a typical mountain bike. Create the DownhillMountainBike class with getFrameStrength(), setFrameStrength(int strength), and printDescription() methods. The frame strength is to be a value in between 1 and 10, inclusive. Test the DownhillMountainBike class using the TestBikes class from the same web link provided above.

    I'm a bit confuse, so do I extend the MountainBike to create another DownhillMountainBike class. so MountainBike is like the super class for the class I have to create?, and where it says to test the DownhillMountainBike class using the TestBikes class, does this mean that am I using the same code?

    I just need to understand the question, sometimes I understand something completely different and I can't fail this time!, thank you in advance.

    Dai
    Last edited by Dai; 09-17-2013 at 04:14 AM.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Please help me to understand this question!

    Please do not use coloured text in your post.

    Most people will not follow links.

    There is plenty of information about polymorphism, inheritance and interfaces on the web and in books. Anything we post here will simply repeat what is already out there. Do some research. Then ask a specific question

  3. #3
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Please help me to understand this question!

    MountainBike to create another DownhillMountainBike class
    Yes, I think - your statement is a little goofy. You said "another" DownhillMountainBike class- do you already have one?

    I understand the requirement to say "make a new special type of MountainBike called DownhillMountainBike.
    so MountainBike is like the super class for the class I have to create?
    Yes.

    test the DownhillMountainBike class using the TestBikes class, does this mean that am I using the same code?
    I didn't look at the link, but it seems to be describing something pretty standard - since DownhillMountainBike is just a special type of MountainBike, most tests written for MountainBike should also work on DownhillMountainBike since a DownhillMountainBike is a MountainBike.

Similar Threads

  1. I dont understand this question...
    By Akirien in forum New To Java
    Replies: 8
    Last Post: 08-07-2012, 07:56 PM
  2. Replies: 8
    Last Post: 08-11-2011, 08:23 PM
  3. GUI help. Don t understand
    By s0meb0dy in forum AWT / Swing
    Replies: 2
    Last Post: 10-27-2010, 09:40 PM
  4. List question, I don't understand why...
    By jigglywiggly in forum New To Java
    Replies: 14
    Last Post: 03-21-2010, 08:59 AM
  5. I don´t understand
    By Manikyr in forum New To Java
    Replies: 6
    Last Post: 02-22-2009, 11:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •