007-002-003

Class and Object: Book Information Class

Easy

Problem Description

class and Object: Book Information class

In this problem, you will create a program that defines a Book class with title and price fields, creates an object, reads book information from standard input, and displays the result to standard output.

Learning Objective: Understand the basics of declaring a class and creating objects

Create a Book class that holds book information (title and price), create an object, and display the information.

Input

Line 1: Book title (string)
Line 2: Price (integer)

Output

Title: [title]
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