Examlex

Solved

Consider the Following Class Hierarchy: Public Class Vehicle

question 4

Multiple Choice

Consider the following class hierarchy: public class Vehicle
{
Private String type;
Public Vehicle(String type)
{
This.type = type;
}
Public String displayInfo()
{
Return type;
}
}
Public class LandVehicle extends Vehicle
{
Public LandVehicle(String type)
{
Super(type) ;
}
}
Public class Auto extends LandVehicle
{
Public Auto(String type)
{
Super(type) ;
}
}
You have written a program to use these classes, as shown in the following code snippet:
Public class VehicleTester
{
Public static void main(String[] args)
{
Auto myAuto = new Auto("sedan") ;
System.out.println("MyAuto type = " + ______) ;
}
}
Complete the code in this program snippet to correctly display the auto's type.


Definitions:

Depreciation Expense

The orderly apportionment of a tangible asset's cost over the duration of its use.

Residual Value

The estimated value that an asset will have at the end of its useful life, after depreciation has been taken into account.

Double Declining Balance

A method of accelerated depreciation which doubles the depreciation rate of the straight-line method, resulting in higher depreciation expenses in the earlier years of an asset's life.

Intangible Assets

Non-physical assets that hold value, such as patents, trademarks, and goodwill.

Related Questions