001-004-001
Variable Value Update: Cooking Time Record
Easy
Problem Description
variable Value Update: Cooking Time Record
In this problem, you will create a program that reads three integers representing cooking durations, cumulatively adds each step's time to a single running-total variable, and displays the accumulated cooking time after each step in a formatted output to standard output.
Learning Objective: Understand how to update variable values step by step
Create a recipe app. Input preparation time first, then add time for two cooking steps. Display cumulative time after each step.
Input
Line 1: Preparation time (integer, minutes)
Line 2: First cooking step time (integer, minutes)
Line 3: Second cooking step time (integer, minutes)
Output
================================
Cooking Time Record
================================
Preparation: [time] min
After Step 1: [cumulative time] min
After Step 2: [total time] min
================================
```java
## Examples
### Example 1: 10min prep, 15min stir-fry, 20min simmer
Input:
```java
10
15
20
```java
Output:
```java
================================
Cooking Time Record
================================
Preparation: 10 min
After Step 1: 25 min
After Step 2: 45 min
================================
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
8 12 25
Expected Output:
================================ Cooking Time Record ================================ Preparation: 8 min After Step 1: 20 min After Step 2: 45 min ================================
Normal case
Input:
5 10 30
Expected Output:
================================ Cooking Time Record ================================ Preparation: 5 min After Step 1: 15 min After Step 2: 45 min ================================
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
