Skip to content

Commit 85b3a82

Browse files
Загрузка уроков 1,2,3
0 parents  commit 85b3a82

23 files changed

Lines changed: 683 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class MyFirstApp {
2+
public static void main (String[] args) {
3+
System.out.println ("Hello, world");
4+
}
5+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
public class BeerSong{
2+
public static void main (String[] args){
3+
int beerNumber = 99;
4+
String word = "бутылок (бутылки)";
5+
6+
while(beerNumber > 0){
7+
8+
if (beerNumber == 1){
9+
word = "бутылка";
10+
}
11+
12+
else if (beerNumber < 0 ) {
13+
System.out.println("Нет бутылок пива на стене");
14+
}
15+
16+
17+
System.out.println(beerNumber + " " + word + " пива на стене");
18+
System.out.println("Возьми одну.");
19+
System.out.println("Пусти по кругу.");
20+
beerNumber --;
21+
22+
}
23+
}
24+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
public class ConditionalStatement {
2+
public static void main(String[] args){
3+
4+
int age = 34;
5+
String sex = "male";
6+
float growth = 1.7f;
7+
char name = 'Д';
8+
9+
if(age > 20)
10+
System.out.println(" Вам больше двaдцати лет.");
11+
12+
13+
if(sex == "male" )
14+
System.out.println(" Вы мужского пола");
15+
16+
17+
if(sex == "fmale")
18+
System.out.println(" Вы женского пола");
19+
20+
21+
if(growth < 1.80)
22+
System.out.println(" Ваш рост ниже среднего");
23+
else
24+
System.out.println(" Ваш рост выше среднего");
25+
26+
27+
if(name == 'М')
28+
System.out.println(" Ваше имя начинатся с буквы М");
29+
else if(name == 'И')
30+
System.out.println(" Ваше имя начинатся с буквы И");
31+
else
32+
System.out.println(" Ваше имя начинатся с буквы " + name);
33+
}
34+
35+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class Cycle {
2+
public static void main(String[] args){
3+
4+
//Выведите на консоль с помощью цикла for все числа от [0, 20]
5+
// for(int i = 0; i <= 20; i++)
6+
// System.out.println(i);
7+
8+
//Выведите на консоль с помощью цикла while все числа от [6, -6] (шаг итерации равен 2)
9+
// int i = 6;
10+
// while(i >=-6 ){
11+
// System.out.println(i);
12+
// i = i - 2;
13+
// }
14+
15+
//Выведите на консоль с помощью цикла do-while сумму всех нечетных чисел от [10, 20]
16+
int i = 10;
17+
int result = 0;
18+
do{
19+
if(i % 2 != 0)
20+
result = result + i;
21+
i++;
22+
}while(i<20);
23+
System.out.println(result);
24+
}
25+
26+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class DooBee {
2+
public static void main (String[] args) {
3+
int x = 1;
4+
while(x < 3){
5+
System.out.print("Doo");
6+
System.out.print("Bee");
7+
x++;
8+
}
9+
if(x==3);{
10+
System.out.println("Do");
11+
}
12+
13+
}
14+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
public class Main{
2+
public static void main(String[] args){
3+
4+
// int result = 1;
5+
// for(int i = 2; i <= 5; i++){
6+
// result = result + i;
7+
// if(result % 2 == 0)
8+
// System.out.println("Число " + result + " четное");
9+
// else
10+
// System.out.println("Число " + result +" нечетное");
11+
// }
12+
13+
// int i = 2;
14+
// int result = 1;
15+
// while(i<=5){
16+
// result = result + i;
17+
// if(result % 2 == 0)
18+
// System.out.println("Число " + result + " четное");
19+
// else
20+
// System.out.println("Число " + result +" нечетное");
21+
// i++;
22+
// }
23+
24+
int i = 2;
25+
int result = 1;
26+
do {
27+
result = result + i;
28+
if(result % 2 == 0)
29+
System.out.println("Число " + result + " четное");
30+
else
31+
System.out.println("Число " + result +" нечетное");
32+
i++;
33+
} while(i<=5);
34+
35+
36+
37+
/* int sum = 1 + 2;
38+
if(sum % 2 == 0)
39+
System.out.println("Число " + sum + " четное");
40+
else
41+
System.out.println("Число " + sum +" нечетное");
42+
43+
int sum1 = sum + 3;
44+
if(sum1 % 2 == 0)
45+
System.out.println("Число " + sum1 + " четное");
46+
else
47+
System.out.println("Число " + sum1 +" нечетное");
48+
49+
int sum2 = sum1 + 4;
50+
if(sum2 % 2 == 0)
51+
System.out.println("Число " + sum2 + " четное");
52+
else
53+
System.out.println("Число " + sum2 +" нечетное");
54+
55+
int sum3 = sum2 + 5;
56+
if(sum3 % 2 == 0)
57+
System.out.println("Число " + sum3 + " четное");
58+
else
59+
System.out.println("Число " + sum3 +" нечетное");
60+
*/
61+
62+
}
63+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class PharseMatic{
2+
public static void main (String[] args){
3+
String[] wordListOne = {" Круглосуточный", "трехзвенный", "3000 футовый",
4+
"взаимный", "обоюдный выигрыш", "фронтэнд", "на основе веб-технологий" };
5+
6+
String[] wordListTow = {" Уполномоченый", "трудный", "чистый продукт",
7+
"ориентированный","центральный", "распределенный", "фирменный"};
8+
9+
String[] wordListThree = {" Процесс","пункт разгрузки", "выход из положения",
10+
"тип структуры","талант", "подход","уровень завоевонного внимания" };
11+
12+
int oneLength = wordListOne.length;
13+
int towLength = wordListTow.length;
14+
int threeLength = wordListThree.length;
15+
16+
int rand1 = (int) (Math.random() * oneLength);
17+
int rand2 = (int) (Math.random() * towLength);
18+
int rand3 = (int) (Math.random() * threeLength);
19+
20+
String phrase = wordListOne[rand1] + " " +
21+
wordListTow[rand2] + " " +wordListThree[rand3];
22+
23+
System.out.println ("Все что нам нужно, - это " + phrase);
24+
25+
}
26+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
public class Shuf{
2+
public static void main (String[] args){
3+
int x = 3;
4+
5+
while(x > 0){
6+
7+
if(x > 2){
8+
System.out.print("a");
9+
}
10+
11+
x = x - 1;
12+
System.out.print("-");
13+
14+
if(x == 2){
15+
System.out.print("b с");
16+
}
17+
18+
x = x - 1;
19+
System.out.print("-");
20+
21+
if(x == 1){
22+
System.out.println("d");
23+
x = x - 1;
24+
}
25+
26+
}
27+
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
public class Varible{
2+
public static void main(String[] args) {
3+
String name = "MacBook";
4+
byte core = 5;
5+
short frequency = 1600;
6+
int ram = 8;
7+
long graphics = 1536;
8+
float processor = 2.6f;
9+
double monitor = 13.3;
10+
char type = 'I';
11+
12+
System.out.println("Компьютер-"+name);
13+
System.out.println("Процессор-"+type+core);
14+
System.out.println("Частота процессора-"+processor+"MHz");
15+
System.out.println("Память-"+ram+"Mb");
16+
System.out.println("Видеокарта-"+graphics+"Mb");
17+
System.out.println("Монитор-"+monitor+" дюйма");
18+
19+
}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
public class MyFirstGame{
2+
public static void main (String[] args){
3+
int computerNumber = 3;
4+
int humenNumber = 10;
5+
6+
while(true){
7+
if(humenNumber == computerNumber){
8+
System.out.println("Вы угадали!" + computerNumber);
9+
break;
10+
}
11+
if(humenNumber < computerNumber){
12+
System.out.println("Введеное вами число = " + humenNumber + " меньше того, что загадал компьютер");
13+
humenNumber++;
14+
}
15+
if(humenNumber > computerNumber){
16+
System.out.println("Введеное вами число " + humenNumber + " больше того, что загадал компьютер");
17+
humenNumber--;
18+
}
19+
}
20+
21+
}
22+
}

0 commit comments

Comments
 (0)