007-002-002
Class and Object: Product Class
Easy
Problem Description
Class and Object: Product Class
Learning Objective: Declare class and create object
Create Product class with product name and price, create object and display information. Implement constructor and methods.
Input
Line 1: Product name (string)
Line 2: Price (integer)
Output
Product: [name]
Price: [price] yen
```java
## Examples
### Example 1: Notebook 120 yen
Input:
```java
Notebook
120
```java
Output:
```java
Product: Notebook
Price: 120 yen
```java
### Example 2: Eraser 80 yen
Input:
```java
Eraser
80
```java
Output:
```java
Product: Eraser
Price: 80 yen
```java
### Example 3: Minimum value (boundary)
Input:
```java
A
0
```java
Output:
```java
Product: A
Price: 0 yen
Test Cases
※ Output examples follow programming industry standards
Input:
Notebook 120
Expected Output:
Product: Notebook Price: 120 ¥
Input:
Eraser 80
Expected Output:
Product: Eraser Price: 80 ¥
Input:
A 0
Expected Output:
Product: A Price: 0 ¥
❌ 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
