007-002-006
Class and Object: Product Class
Easy
Problem Description
class and Object: Product class
In this problem, you will create a program that defines a Product class with a name and price, implements a constructor and a display method, instantiates the class from standard input, and displays the result to standard output.
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
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up