Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lesson 2 homework #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions lesson2/src/main/java/ru/gb/savilin/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ru.gb.savilin;

public class Main {

private static boolean isEqualsInterval(int a, int b){
if ((a+b>=10)&&(a+b<=20)){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return true;
}else {
return false;
}
}

private static void printNegativeOrPositive(int a){
if (a<0){
System.out.println("Number is negative");
}else{
System.out.println("Number is positive");
}
}

private static boolean isNegativeNumber(int a){
if(a<0) return true;
else{
return false;
}
}

private static void manyStringsPrinter(String s, int counter){
for (int i=0;i<counter;i++){
System.out.println(s);
}
}

private static boolean isLeapYear(int year){
if (year%4==0 && year%100!=0 || year%400==0){
return true;
}else {
return false;
}
}

public static void main(String[] args) {
System.out.println(isEqualsInterval(8,13));
printNegativeOrPositive(5);
System.out.println(isNegativeNumber(3));
manyStringsPrinter("test",2);
System.out.println(isLeapYear(800));
}
}