-->
当前位置:首页 > 题库

PROGRAMMING:Segmented calculation of residential water charges [2]

Luz5年前 (2021-05-10)题库411
In order to encourage the residents to save water, the water company adopts the method of pricing according to the water consumption step by step. The relationship between the residents' water fee $$y $$(yuan) and the monthly water consumption $$x $$(ton) is as follows. Please write a program to calculate the water fee.
![ E3-4.png](~/c111c4fe-68dd-4ced-be4c-ee24fdb116a4.png)
###Input format:
The input gives the real number x on one line.
###Output format:
According to the following format, output the monthly water consumption and water fee in one line, which are accurate to 2 decimal places. Please note that there is a space on the left and right of the equal sign.
F (input monthly water consumption) = calculated water charge payable
###Input sample 1:
```in
-0.5
```
###Output sample 1:
```out
f(-0.50) = 0.00
```
###Input sample 2:
```in
0
```
###Output sample 2:
```out
f(0.00) = 0.00
```
###Input sample 3:
```in
nine point five
```
###Output sample 3:
```out
f(9.50) = 12.67
```
###Input sample 4:
```in
fifteen
```
###Output sample 4:
```out
f(15.00) = 20.00
```
###Input sample 5:
```in
twenty-one point three
```
###Output sample 5:
```out
f(21.30) = 42.75
```






answer:If there is no answer, please comment