package com.codegym.task.task04.task0412;
/*
Positive and negative numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
int number = Integer.parseInt(s);
System.out.println(number);
checkPositiveOfNumber(number);
checkNegativeOfNumber(number);
checkEqualNull(number);
}
public static int checkPositiveOfNumber(int number) {
if (number > 0) {
number = number * 2;
System.out.println(number);
}
return number;
}
public static int checkNegativeOfNumber(int number) {
if (number < 0) {
number = number + 1;
System.out.println(number);
}
return number;
}
public static int checkEqualNull(int number) {
if (number == 0) {
System.out.println(number);
}
return number;
//write your code here
}
}
??? what's wrong? It does'n work
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Mareike Frontend Developer
30 April 2019, 17:20
Hey hey,
1. there is no need to read anything from the keyboard
2. the program should only consist of the main method and the method checkSeason
3. the only thing that the main method is supposed to do is, call the checkSeason method. E.g. you want to know what season december is a part of
4. the checkSeason tells the main method which months make what season. So there are four seasons which makes four possibilities.
Hope that helped :)
+1
Николай
1 May 2019, 15:33
Thank You
0