009-002-001
public Modifier: Point Card
Easy
Problem Description
public Modifier: Point Card
In this problem, you will create a program that implements a PointCard class with a private field for storing points and public methods for adding and retrieving points, then displays the initial points, added amount, and current total to standard output.
Learning Objective: Combine public methods with private fields
Create a PointCard class to manage a point card system. Protect the points using a private field, and implement public methods that allow adding points and retrieving the current balance.
Input
Line 1: Points to add (integer)
Output
Initial points: 0
Added: [points]
Current points: [total]
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
100
Expected Output:
Initial points: 0 Added: 100 Current points: 100
Normal case
Input:
250
Expected Output:
Initial points: 0 Added: 250 Current points: 250
Your Solution
Current Mode:● My Code
PointCard.java🔒
Solution.java🔒
2/6 ファイル98B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class PointCard {
}
0 B / 5 MB
You have 10 free executions remaining
