-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLessonOne.java
More file actions
49 lines (41 loc) · 1.69 KB
/
Copy pathLessonOne.java
File metadata and controls
49 lines (41 loc) · 1.69 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public class LessonOne {
public static void main (String[] args){
byte myByte=2;
short myShort=300;
int myInt=2000000;
long myLong=989898988;
float myfloat= 0.1F;
double myDouble=35.698;
String myString="Привет!";
char myChar=64;
boolean myBoolean=false;
System.out.println("Результат задания 3: "+ taskThree(2,0.5,15,5));
System.out.println("Результат задания 4: "+ taskFour(2,5));
taskFive(-10);
System.out.println("Результат задания 6: "+ taskSix(2));
taskSeven("Егор");
taskEight(2020);
}
static double taskThree (double a, double b, double c, double d){
return (a*(b+(c/d)));
}
static boolean taskFour(int a, int b){
if ((a+b)<=20 && (a+b)>=10)return true;
else return false;
}
static void taskFive(int a){
if (a>=0) System.out.println("Результат задания 5:Переданное число положительное");
else System.out.println("Результат задания 5:Переданное число отрицательное");
}
static boolean taskSix (int a){
if (a<0) return true;
else return false;
}
static void taskSeven(String a){
System.out.println ("Резултат задания 7: Привет, "+a+"!");
}
static void taskEight(int a){
if ((a%4==0 && a%100!=0)||a%400==0)System.out.println("Результат задания 8: год високосный");
else System.out.println("Результат задания 8: год не високосный");
}
}