Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with Java homework. Thank you. 1. Abstract Class Write an abstract class for bicycle. You can call it Bike or Bicycle. Declare fields numberOfTires

Help with Java homework. Thank you.

1. Abstract Class

Write an abstract class for bicycle. You can call it Bike or Bicycle. Declare fields numberOfTires (Wait... what? A bicycle has 2 tires. Except when it doesn't!

and numberOfFlats.

Declare 2 abstract methods ride and brake.

Remember you only declare the method, you do not implement it!

Next write a non-abstract subclass TwoWheeledBike. This will extend Bike (or Bicycle). Notice will need to now declare (write the body) of the methods.

Finally, we need a tester/driver to use our methods. It is the only class with the main.

2. Interfaces and Polymorphism

Write an interface Measurements that contains methods perimeter and area.

Write two classes which use the interface:

Rectangle

Square (include Math.pow in your Square class)

Write a driver(tester) class to accept user input necessary for the square and rectangle and print its calculations.

If you google compute the area of square using square calc: find P or rectangle rectangle calc: find P, you can find a nifty calculator.

Thank you again.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

Students also viewed these Databases questions

Question

Detail five of the concepts that underlie PFP theory?

Answered: 1 week ago