007-001-003

Class Creation: Product Class

Medium

Problem Description

class Creation: Product class

In this problem, you will create a program that defines a Product class with name and price fields, creates an instance from standard input, and calls a method to display the product information to standard output.

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

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