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

Library Fine Estimator

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create a helper class that estimates a library fine and applies a maximum cap.

Input Format

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

  1. late days
  2. daily fee
  3. fine cap

Output Format

Print the exact report in this order:

  1. Raw Fine
  2. Final Fine

Sample Testcases

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

Sample #1
Public sample
3
1.5
10.0
Raw Fine: 4.50
Final Fine: 4.50
Input: late days = 3, daily fee = 1.5, fine cap = 10.0.
Key calculation(s): rawFine = 3 * 1.5 | finalFine = Math.min(rawFine, 10.0) | "Raw Fine: " + String.format("%.2f", rawFine) = "Raw Fine: 4.50".
Output:
Raw Fine: 4.50
Final Fine: 4.50
Sample #2
Public sample
10
2.0
12.0
Raw Fine: 20.00
Final Fine: 12.00
Input: late days = 10, daily fee = 2.0, fine cap = 12.0.
Key calculation(s): rawFine = 10 * 2.0 | finalFine = Math.min(rawFine, 12.0) | "Raw Fine: " + String.format("%.2f", rawFine) = "Raw Fine: 20.00".
Output:
Raw Fine: 20.00
Final Fine: 12.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