Previous Next
0 / 15
Module DEMO-33-69DEMO-OOP-33

Inventory Item Tracker

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create two Java files: Main.java and InventoryItem.java.

Read the required values, construct a InventoryItem object, and print a multiline report.

The report must contain these lines in this order:

  1. Item
  2. Ending Stock
  3. Stock Value

Use a constructor and keep the object-oriented structure clear.

Input Format

Input is provided as separate whitespace-separated tokens in the same order described in the problem statement.

Output Format

Print the exact multiline report required by the question.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
Pen
20
5
7
1.5
Item: Pen
Ending Stock: 18
Stock Value: 27.00
Input: item name = "Pen", starting stock = 20, added stock = 5, sold stock = 7, unit price = 1.5.
Key calculation(s): "Item: " + "Pen" = "Item: Pen" | "Ending Stock: " + 20 + 5 - 7 = "Ending Stock: 18".
Output:
Item: Pen
Ending Stock: 18
Stock Value: 27.00
Sample #2
Public sample
Book
10
4
3
8.0
Item: Book
Ending Stock: 11
Stock Value: 88.00
Input: item name = "Book", starting stock = 10, added stock = 4, sold stock = 3, unit price = 8.0.
Key calculation(s): "Item: " + "Book" = "Item: Book" | "Ending Stock: " + 10 + 4 - 3 = "Ending Stock: 11".
Output:
Item: Book
Ending Stock: 11
Stock Value: 88.00

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings