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

Restaurant Order Model

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

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

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

The report must contain these lines in this order:

  1. Item
  2. Subtotal
  3. Total

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
MEAL
2
5.0
10.0
Item: MEAL
Subtotal: 10.00
Total: 11.00
Input: item code = "MEAL", quantity = 2, unit price = 5.0, service percent = 10.0.
Key calculation(s): "Item: " + "MEAL" = "Item: MEAL" | "Subtotal: " + String.format("%.2f", 2 * 5.0) = "Subtotal: 10.00".
Output:
Item: MEAL
Subtotal: 10.00
Total: 11.00
Sample #2
Public sample
JUICE
3
1.5
5.0
Item: JUICE
Subtotal: 4.50
Total: 4.73
Input: item code = "JUICE", quantity = 3, unit price = 1.5, service percent = 5.0.
Key calculation(s): "Item: " + "JUICE" = "Item: JUICE" | "Subtotal: " + String.format("%.2f", 3 * 1.5) = "Subtotal: 4.50".
Output:
Item: JUICE
Subtotal: 4.50
Total: 4.73

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