011-001-007
Constructor Definition: Product Information
Easy
Problem Description
constructor Definition: Product Information
In this problem, you will create a program that creates a Product class with a constructor that receives a product name, unit price, and quantity, calculates the total amount, and displays the result to standard output.
Learning Objective: Perform calculations in constructor
Create class managing product information. Receive unit price and quantity in constructor, calculate total amount.
Input
Line 1: Product name (string)
Line 2: Unit price (integer)
Line 3: Quantity (integer)
Output
Product: [name]
Unit price: [price] yen
Quantity: [quantity] items
Total: [total] 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