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

Online Order Inheritance

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create an online-order subclass that extends a base order and prints the grand total.

Input Format

Input is given as whitespace-separated tokens for the base-class fields first, followed by the child-class fields.

Output Format

Print the exact multiline report required by the problem.

Sample Testcases

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

Sample #1
Public sample
O10
20.0
3.0
Order: O10
Items: 20.00
Grand Total: 23.00
Input: order id = "O10", items total = 20.0, shipping fee = 3.0.
Key calculation(s): "Order: " + "O10" = "Order: O10" | "Items: " + String.format("%.2f", 20.0) = "Items: 20.00".
Output:
Order: O10
Items: 20.00
Grand Total: 23.00
Sample #2
Public sample
O20
50.5
5.5
Order: O20
Items: 50.50
Grand Total: 56.00
Input: order id = "O20", items total = 50.5, shipping fee = 5.5.
Key calculation(s): "Order: " + "O20" = "Order: O20" | "Items: " + String.format("%.2f", 50.5) = "Items: 50.50".
Output:
Order: O20
Items: 50.50
Grand Total: 56.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