004-006-005
Array Copy: Recipe Ingredients List
Easy
Problem Description
Array Copy: Recipe Ingredients List
Learning Objective: Copy string array elements to another array
Manage recipe ingredient lists. Copy original recipe ingredients to a new array and display both lists side by side.
Input
Line 1: Number of ingredients n (1-5)
Following lines: Ingredient names (n items)
Output
=== Recipe Ingredients ===
Original Recipe:
1. [ingredient1]
2. [ingredient2]
...
Copied Recipe:
1. [ingredient1]
2. [ingredient2]
...
Total Ingredients: [n] items
```java
## Examples
### Example 1: Copy 3 Ingredients
Input:
```java
3
eggs
milk
sugar
```java
Output:
```java
=== Recipe Ingredients ===
Original Recipe:
1. eggs
2. milk
3. sugar
Copied Recipe:
1. eggs
2. milk
3. sugar
Total Ingredients: 3 items
Test Cases
※ Output examples follow programming industry standards
Input:
3 卵 牛乳 Sugar
Expected Output:
=== Recipe Ingredients === Original Recipe: 1. Egg 2. Milk 3. Sugar Copied Recipe: 1. Egg 2. Milk 3. Sugar Total Ingredients: 3 items
Input:
2 バター 小麦粉
Expected Output:
=== Recipe Ingredients === Original Recipe: 1. Butter 2. Flour Copied Recipe: 1. Butter 2. Flour Total Ingredients: 2 items
Input:
1 Salt
Expected Output:
=== Recipe Ingredients === Original Recipe: 1. Salt Copied Recipe: 1. Salt Total Ingredients: 1 items
❌ Some tests failed
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 6 free executions remaining
