package com.codegym.task.task04.task0416;
/*
Crossing the road blindly
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
float t;
float result;
InputStream inputStream=System.in;
Reader inputStreamReader=new InputStreamReader(inputStream);
BufferedReader bufferedReader=new BufferedReader(inputStreamReader);
String time=bufferedReader.readLine();
t = Float.parseFloat(time);
result=time%5.0;
if(result <3)
System.out.println("green");
else if(result <4)
System.out.println("yellow");
else {
System.out.println("red");
}
}
Bad operand types??
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Anastasia Falcon
26 April 2019, 13:01
result=time%5.0; // result = t % 5 ? time is a string and t is a float if I understand correctly
+2
dpp
26 April 2019, 14:52
Thank You! That was very helpful
+1