018-001-005
Recipe Manager: Managing Multiple Information with Classes
Medium
Problem Description
In this problem, you will implement the showRecipe() method in the Recipe class that outputs the dish name, ingredient count, and cooking time in a specified format.
[Problem Description]
You are developing a recipe management application. Create a Recipe class to manage recipe information.
Requirements
Field Definition
- dishName: Name of the dish (String)
- ingredientCount: Number of ingredients (int)
- cookingTime: Cooking time in minutes (int)
-
- Accept 3 arguments (dishName, ingredientCount, cookingTime)
- Initialize all fields
Information Display method
- Implement showRecipe() method
- Output in the following format:
Dish: [dish name] Ingredients: [ingredient count] Time: [cooking time] minutes ```java
Learning Points
- Classes are tools to represent real-world objects
- Fields can hold mixed data types
- Methods access field data to perform processing.
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up