016-001-002

Abstract Class Basics: Vehicle

Hard

Problem Description

abstract class Basics: Vehicle

In this problem, you will create a program that defines an abstract class Vehicle, implements Car and Bike subclasses that inherit from it, and displays the movement method corresponding to the input vehicle type to standard output.

Learning Objective: Understand definition and usage of abstract classes

Create Car and Bike classes inheriting from abstract class Vehicle, displaying movement method.

Input

Line 1: Vehicle type (car or bike)
Line 2: Vehicle name

Output

Vehicle: [name]
Move: [movement method]

Example

Input:

car
Toyota

Output:

Vehicle: Toyota
Move: Driving on road

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
bike
Suzuki
Expected Output:
Vehicle: Suzuki
Move: Riding on path
Normal case
Input:
bike
Yamaha
Expected Output:
Vehicle: Yamaha
Move: Riding on path

Your Solution

Current Mode: My Code
Vehicle.java🔒
Car.java🔒
Bike.java🔒
Main.java🔒
4/6 ファイル214B
⚠️警告
  • No main method found
import java.util.Scanner;

abstract class Vehicle {
}
0 B / 5 MB

You have 10 free executions remaining