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

Power Usage Bill

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read consumed units, unit cost, and service fee, then print the final bill.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. consumed units
  2. cost per unit
  3. service fee

Output Format

Print the exact report in this order:

  1. Units
  2. Bill

Sample Testcases

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

Sample #1
Public sample
100
0.5
3.0
Units: 100
Bill: 53.00
Input: consumed units = 100, cost per unit = 0.5, service fee = 3.0.
Key calculation(s): total = (100 * 0.5) + 3.0 | "Units: " + 100 = "Units: 100" | "Bill: " + String.format("%.2f", total) = "Bill: 53.00".
Output:
Units: 100
Bill: 53.00
Sample #2
Public sample
250
0.75
5.5
Units: 250
Bill: 193.00
Input: consumed units = 250, cost per unit = 0.75, service fee = 5.5.
Key calculation(s): total = (250 * 0.75) + 5.5 | "Units: " + 250 = "Units: 250" | "Bill: " + String.format("%.2f", total) = "Bill: 193.00".
Output:
Units: 250
Bill: 193.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