014-006-002

super.method Call: Recipe Management

Easy

Problem Description

super.method Call: Recipe Management

In this problem, you will create a program that calls super.displayRecipe() inside the Dessert class (which inherits from Recipe) to extend the parent's output with dessert-specific information and displays the result to standard output.

Learning Objective: Call parent class method with super.methodName() to extend functionality

Create Recipe class representing recipes and Dessert class inheriting from it. Call super.displayRecipe() inside child's displayRecipe() to add extra info to parent's output.

Input

recipe name (String)
cooking time (int, in minutes)
flavor (String)

Output

Recipe: <name>
Cooking Time: <time> minutes
Flavor: <flavor>

Examples

Example 1: Chocolate Cake

Input:

Chocolate Cake
45
Chocolate

Output:

Recipe: Chocolate Cake
Cooking Time: 45 minutes
Flavor: Chocolate

Example 2: Cheesecake

Input:

Cheesecake
60
Vanilla

Output:

Recipe: Cheesecake
Cooking Time: 60 minutes
Flavor: Vanilla

Example 3: Brownies

Input:

Brownies
30
Dark Chocolate

Output:

Recipe: Brownies
Cooking Time: 30 minutes
Flavor: Dark Chocolate

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
Strawberry Tart
35
Strawberry
Expected Output:
Recipe: Strawberry Tart
Cooking Time: 35 minutes
Flavor: Strawberry
Normal case
Input:
Lemon Mousse
15
Lemon
Expected Output:
Recipe: Lemon Mousse
Cooking Time: 15 minutes
Flavor: Lemon

Your Solution

Current Mode: My Code
Recipe.java🔒
Dessert.java🔒
Solution.java🔒
3/6 ファイル525B
public class Recipe {
}
0 B / 5 MB

You have 10 free executions remaining