007-001-004
Class Creation: Product Information
Easy
Problem Description
class Creation: Product Information
In this problem, you will create a program that defines a Product class with name and price fields, instantiates it with values read from standard input, and displays the product information to standard output.
Learning Objective: Understand the basic structure of classes
Create a Product class with name and price, and display product information.
Input
Line 1: Product name (string)
Line 2: Price (integer)
Output
Product: [name]
Price: [price] yen
```java
## Example
Input:
```java
Pen
100
```java
Output:
```java
Product: Pen
Price: 100 yen
Test Cases
※ Output examples follow programming industry standards
Input:
Pen 100
Expected Output:
Product: Pen Price: 100 yen
Input:
Notebook 250
Expected Output:
Product: Notebook Price: 250 yen
Input:
Free Sample 0
Expected Output:
Product: Free Sample Price: 0 yen
Input:
A 1
Expected Output:
Product: A Price: 1 yen
❌ Some tests failed
Your Solution
Current Mode:● My Code
Product.java🔒
Main.java🔒
2/6 ファイル92B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class Product {
}
0 B / 5 MB
You have 9 free executions remaining
