“A different language is a different vision of life.”
-- Federico Fellini
Home
Forum
Blog
Free Trial Class
More
package com.company; public class Main { public static void main(String[] args) { System.out.println(isCatPlaying(true, 10 )); System.out.println(isCatPlaying(false, 106 )); System.out.println(isCatPlaying(false, 35 )); } public static boolean isCatPlaying(boolean summer, int temperature) { if (summer && temperature >= 25 && temperature <= 45) { return true; } if (!summer && temperature >= 25 && temperature <= 35) { return true; } else { return false; } } }
Java Coding Cat Playing
package com.company; public class Main { public static boolean isCatPlaying (boolean summer, int tempreture){ if (tempreture >= 25 && tempreture <= 35 && summer == false){ return true; } if (tempreture >= 25 && tempreture <= 45 && summer == true){ return true; } else return false; } public static void main(String[] args) { System.out.println(isCatPlaying(true, 10)); System.out.println(isCatPlaying(false, 36)); System.out.println(isCatPlaying(false, 35)); } }
public static boolean isCatPlaying (boolean summer, int temperature) { if (summer) { if (temperature >= 45 || temperature <= 25) { return false; } else { return true; } } else { if (temperature >= 35 || temperature >= 25) { return false; } else { return true; } } }
package com.company; public class Main { public static void main(String[] args) { System.out.println(isCatPlaying(true, 10 )); System.out.println(isCatPlaying(false, 106 )); System.out.println(isCatPlaying(false, 35 )); } public static boolean isCatPlaying(boolean summer, int temperature) { if (summer && temperature >= 25 && temperature <= 45) { return true; } if (!summer && temperature >= 25 && temperature <= 35) { return true; } else { return false; } } }
Java Coding Cat Playing
package com.company; public class Main { public static boolean isCatPlaying (boolean summer, int tempreture){ if (tempreture >= 25 && tempreture <= 35 && summer == false){ return true; } if (tempreture >= 25 && tempreture <= 45 && summer == true){ return true; } else return false; } public static void main(String[] args) { System.out.println(isCatPlaying(true, 10)); System.out.println(isCatPlaying(false, 36)); System.out.println(isCatPlaying(false, 35)); } }
public static boolean isCatPlaying (boolean summer, int temperature) { if (summer) { if (temperature >= 45 || temperature <= 25) { return false; } else { return true; } } else { if (temperature >= 35 || temperature >= 25) { return false; } else { return true; } } }