016-002-002
Abstract and Concrete Methods: Vehicle Class
Medium
Problem Description
Abstract and Concrete Methods: Vehicle class
In this problem, you will create a program that defines an abstract class Vehicle with a concrete method startEngine() and an abstract method getType(), overrides getType() in subclasses Car and Bike, and displays vehicle-type messages to standard output based on the input.
Learning Objective: Understand difference between abstract and concrete methods
Combine common concrete methods in abstract class with abstract methods implemented in subclasses.
Input
1 line: Vehicle type (car or bike)
Output
Starting engine...
Vehicle type: [type]
```java
## Example
Input:
```java
car
```java
Output:
```java
Starting engine...
Vehicle type: Car
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
car
Expected Output:
Starting engine... Vehicle type: Car
Normal case
Input:
bike
Expected Output:
Starting engine... Vehicle type: Bike
Your Solution
Current Mode:● My Code
Vehicle.java🔒
Car.java🔒
Bike.java🔒
Main.java🔒
4/6 ファイル214B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
abstract class Vehicle {
}
0 B / 5 MB
You have 10 free executions remaining
