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

PROGRAMMING:Calculation of water charges by sections

Luz5年前 (2021-05-10)题库406
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 water fee y (yuan) paid by the residents is related to the monthly water consumption x (ton): when X does not exceed 15 tons, y = 4x / 3; After exceeding, y = 2.5x − 17.5. Please write a program to calculate the water charge.
###Input format:
The input gives a nonnegative real number x on one line.
###Output format:
Output the water charge to be paid in one line, accurate to 2 decimal places.
If the input x is negative, input data error! Is output!.
###Input example:
```in
twelve
```
###Output example:
```out
sixteen
```
###Input example:
```in
sixteen
```
###Output example:
```out
twenty-two point five zero
```
###Input example:
```in
-10
```
###Output example:
```out
Input Data error!
```







answer:If there is no answer, please comment