004-007-002
Array Length: Recipe Steps Count
Easy
Problem Description
array Length: Recipe Steps Count
Learning Objective: Get element count with String array's length property
In this problem, you will create a program that reads recipe steps from standard input into a String array, retrieves the element count using the .length property, and displays the result in the specified format to standard output.
Manage cooking recipe steps. Read recipe steps stored in an array and display total step count using .length property.
Input
Line 1: Number of steps n (1-5)
Following lines: Step descriptions (n items)
Output
=== Recipe Steps ===
Total Steps: [n] items
━━━━━━━━━━━━━━━━
Step 1: [step1]
Step 2: [step2]
...
━━━━━━━━━━━━━━━━
All [n] steps loaded!
```java
## Examples
### Example 1: 3-Step Recipe
Input:
```java
3
Cut ingredients
Boil in pot
Serve
```java
Output:
```java
=== Recipe Steps ===
Total Steps: 3 items
━━━━━━━━━━━━━━━━
Step 1: Cut ingredients
Step 2: Boil in pot
Step 3: Serve
━━━━━━━━━━━━━━━━
All 3 steps loaded!
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
3 Cut ingredients Boil in pot Plate and serve
Expected Output:
=== Recipe Steps === Total Steps: 3 items ━━━━━━━━━━━━━━━━ Step 1: Cut ingredients Step 2: Boil in pot Step 3: Plate and serve ━━━━━━━━━━━━━━━━ All 3 steps loaded!
Normal case
Input:
2 Heat the pan Fry the egg
Expected Output:
=== Recipe Steps === Total Steps: 2 items ━━━━━━━━━━━━━━━━ Step 1: Heat the pan Step 2: Fry the egg ━━━━━━━━━━━━━━━━ All 2 steps loaded!
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 10 free executions remaining
