004-010-001
Multidimensional Array Element Count: Menu Table Size
Easy
Problem Description
Multidimensional Array Element Count: Menu Table Size
Learning Objective: Get row and column counts of 2D array
Check data scale of weekly menu table. Use .length property of 2D array to get how many days of data exist (row count) and how many meals per day (column count). Learn that for 2D arrays, outer .length represents row count and inner .length represents column count.
Input
Line 1: Number of days n (1-3)
Following lines: Menus for n days (3 meals per day: breakfast lunch dinner)
Output
=== Menu Table Size ===
Days: [n] days
Meals: [3] meals per day
━━━━━━━━━━━━━━━━
Total: [n×3] meals of data
```java
## Examples
### Example 1: Menu table for 2 days
Input:
```java
2
Bread Salad Curry
Rice Ramen Sushi
```java
Output:
```java
=== Menu Table Size ===
Days: 2 days
Meals: 3 meals per day
━━━━━━━━━━━━━━━━
Total: 6 meals of data
Test Cases
※ Output examples follow programming industry standards
Input:
2 Bread Salad Curry Rice Ramen Sushi
Expected Output:
=== Menu Table Size === Days: 2 days Meals: 3 meals per day ━━━━━━━━━━━━━━━━ Total: 6 meals of data
Input:
1 Toast Soup Steak
Expected Output:
=== Menu Table Size === Days: 1 days Meals: 3 meals per day ━━━━━━━━━━━━━━━━ Total: 3 meals of data
Input:
3 Onigiri Udon Yakiniku Sandwich Set Meal Hot Pot Cereal Pasta Sashimi
Expected Output:
=== Menu Table Size === Days: 3 days Meals: 3 meals per day ━━━━━━━━━━━━━━━━ Total: 9 meals of data
❌ 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 9 free executions remaining
