Data Class: Inventory Information
Problem Description
Data class: Inventory Information
In this problem, you will create a program that defines an Inventory class with three fields (product name, stock quantity, and unit price), stores values read from standard input into those fields, calculates the total value (stock quantity × unit price), and displays the result to standard output.
Learning Objective: Bundle multiple related data into one using a class to streamline data management
Create a class to manage product inventory information. Bundle three pieces of information into one class: product name, stock quantity, and unit price. A class as a "data container" groups scattered information into meaningful units, simplifying handling in programs.
Input
Line 1: Product name (string)
Line 2: Stock quantity (integer, 0-1000 units)
Line 3: Unit price (integer, 0-100000 yen)
Output
Inventory Information:
Product: [product name]
Stock: [stock quantity]units
Price: [unit price]yen
Total Value: [total value]yen
Total value calculation: Stock quantity × unit price
Examples
Example 1: Laptop Inventory
Input:
Laptop
50
80000
Output:
Inventory Information:
Product: Laptop
Stock: 50units
Price: 80000yen
Total Value: 4000000yen
Example 2: Mouse Inventory
Input:
Mouse
200
1500
Output:
Inventory Information:
Product: Mouse
Stock: 200units
Price: 1500yen
Total Value: 300000yen
Example 3: Zero Stock Keyboard
Input:
Keyboard
0
5000
Output:
Inventory Information:
Product: Keyboard
Stock: 0units
Price: 5000yen
Total Value: 0yen
Test Cases
※ Output examples follow programming industry standards
Headphones 100 3000
Inventory Information: Product: Headphones Stock: 100units Price: 3000yen Total Value: 300000yen
Notebook 500 200
Inventory Information: Product: Notebook Stock: 500units Price: 200yen Total Value: 100000yen
Your Solution
You have 10 free executions remaining
