A) Create an abstract class 'Fares' with an abstract method 'fareCharged()'. $10, $15 and $20 are the fares charged by Bus, Auto and Cab respectively. 'Bus', 'Auto' and 'Cab' are subclasses of class 'Fares', each having a method named 'fareCharged()' which prints the fare charged by different vehicles. Call this method by creating an object of each of the three classes. Expected Output: Fare charged by Bus is $10 Fare charged by Auto is $15 Fare charged by Cab is $20

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
100%

By java programming only.

 

A) Create an abstract class 'Fares' with an abstract method 'fareCharged()'. $10, $15 and $20 are the
fares charged by Bus, Auto and Cab respectively. 'Bus', 'Auto' and 'Cab' are subclasses of class
'Fares', each having a method named 'fareCharged()' which prints the fare charged by different
vehicles. Call this method by creating an object of each of the three classes.
Expected Output:
Fare charged by Bus is $10
Fare charged by Auto is $15
Fare charged by Cab is $20
Transcribed Image Text:A) Create an abstract class 'Fares' with an abstract method 'fareCharged()'. $10, $15 and $20 are the fares charged by Bus, Auto and Cab respectively. 'Bus', 'Auto' and 'Cab' are subclasses of class 'Fares', each having a method named 'fareCharged()' which prints the fare charged by different vehicles. Call this method by creating an object of each of the three classes. Expected Output: Fare charged by Bus is $10 Fare charged by Auto is $15 Fare charged by Cab is $20
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Multithreading Methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT