007-003-002

Class Usage: Point Card

Easy

Problem Description

class Usage: Point Card

In this problem, you will create a program that defines a PointCard class, sets initial points via a constructor, calls a point-adding method, and displays the points before and after adding to standard output.

Learning Objective: Manage state using class

Create program using point card class to check and add points. Call class methods to accumulate points.

Input

Line 1: Initial points (integer)
Line 2: Add points (integer)

Output

Current: [points]pt
After adding: [points]pt

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
100
50
Expected Output:
Current: 100pt
After adding: 150pt
Normal case
Input:
200
100
Expected Output:
Current: 200pt
After adding: 300pt

Your Solution

Current Mode: My Code
PointCard.java🔒
Solution.java🔒
2/6 ファイル98B
⚠️警告
  • No main method found
import java.util.Scanner;

class PointCard {
}
0 B / 5 MB

You have 10 free executions remaining