-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHS08TEST.java
More file actions
27 lines (20 loc) · 927 Bytes
/
HS08TEST.java
File metadata and controls
27 lines (20 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*Problem
Pooja would like to withdraw X $US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful withdrawal the bank charges 0.50 $US.
Calculate Pooja's account balance after an attempted transaction.
*/
import java.util.*;
import java.io.*;
class Solution{
public static void main(String[] args) throws Exception{
InputStreamReader i = new InputStreamReader(System.in);
BufferedReader bf = new BufferedReader(i);
String[] in = bf.readLine().split(" ");
float n = Float.parseFloat(in[0]);
float f = Float.parseFloat(in[1]);
if(n%5==0 && f>=n+0.5f)
System.out.println(f-n-0.5f);
else{
System.out.println(f);
}
}
}