007-001-003
Class Creation: Product Class
Medium
Problem Description
Class Creation: Product Class
Learning Objective: Define a class with fields and methods
Create a class representing a product. Implement with name, price fields and method to display information.
Input
Line 1: Product name (string)
Line 2: Price (integer)
Output
Product created
Name: [name]
Price: [price] yen
Test Cases
※ Output examples follow programming industry standards
Input:
Laptop 150000
Expected Output:
Product created Name: Laptop Price: 150000 ¥
Input:
Pen 100
Expected Output:
Product created Name: Pen Price: 100 ¥
Input:
Sample 0
Expected Output:
Product created Name: Sample 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
