012-001-002
Static Variable: Visit Counter
Easy
Problem Description
static variable: Visit Counter
Learning Objective: Manage class-wide information with static variable
In this problem, you will create a program that designs a class with a static variable, executes the visit operation the specified number of times, and displays the visit count and cumulative total visitor count to standard output.
Create program counting webpage visits. Use static variable to manage total visit count shared across all instances.
Input
Line 1: Visit count (integer)
Output
Visit count: [count] times
Total visitors: [total] people
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
5
Expected Output:
Visit count: 5 times Total visitors: 5 people
Normal case
Input:
10
Expected Output:
Visit count: 10 times Total visitors: 10 people
Your Solution
Current Mode:● My Code
VisitCounter.java🔒
Solution.java🔒
2/6 ファイル101B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class VisitCounter {
}
0 B / 5 MB
You have 10 free executions remaining
