This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level09.lesson11.bonus01; | |
| import java.io.*; | |
| /* Нужно исправить программу, чтобы компилировалась и работала | |
| Задача: Программа вводит два имени файла. И копирует первый файл на место заданное вторым именем. | |
| */ | |
| public class Solution | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level09.lesson11.bonus02; | |
| import java.io.*; | |
| /* Нужно добавить в программу новую функциональность | |
| Задача: Программа вводит два имени файла. И копирует первый файл на место, заданное вторым именем. | |
| Новая задача: Программа вводит два имени файла. И копирует первый файл на место, заданное вторым именем. | |
| Если файла (который нужно копировать) с указанным именем не существует, то | |
| программа должна вывести надпись «Файл не существует.» и еще раз прочитать имя файла с консоли, а уже потом считывать файл для записи. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level09.lesson11.bonus03; | |
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| import java.util.ArrayList; | |
| /* Задача по алгоритмам | |
| Задача: Пользователь вводит с клавиатуры список слов (и чисел). Слова вывести в возрастающем порядке, числа - в убывающем. | |
| Пример ввода: | |
| Вишня |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson04.task01; | |
| /* Задача №1 на преобразование целых типов | |
| Расставьте правильно операторы приведения типа, чтобы получился ответ: d > 0 | |
| int a = 0; | |
| int b = (byte) a + 46; | |
| byte c = (byte) (a*b); | |
| double f = (char) 1234.15; | |
| long d = (short) (a + f / c + b); | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson04.task02; | |
| /* Задача №2 на преобразование целых типов | |
| Расставьте правильно операторы приведения типа, чтобы получился ответ: d=3.765 | |
| int a = 15; | |
| int b = 4; | |
| float c = a / b; | |
| double d = a * 1e-3 + c; | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson04.task03; | |
| /* Задача №3 на преобразование целых типов | |
| Добавить одну операцию по преобразованию типа, чтобы получался ответ: b=0 | |
| float f = (float)128.50; | |
| int i = (int)f; | |
| int b = (int)(i + f); | |
| */ | |
| public class Solution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson04.task04; | |
| /* Задача №4 на преобразование целых типов | |
| Добавить одну операцию по преобразованию типа, чтобы получался ответ: nine=9 | |
| short number = 9; | |
| char zero = '0'; | |
| int nine = (zero + number); | |
| */ | |
| public class Solution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson04.task05; | |
| /* Задача №5 на преобразование целых типов | |
| Расставьте правильно операторы приведения типа, чтобы получился ответ: c=256 | |
| int a = (byte)44; | |
| int b = (byte)300; | |
| short c = (byte)(b - a); | |
| */ | |
| public class Solution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson11.home01; | |
| /* Правильный ответ: d=2.941 | |
| Добавить одну операцию по преобразованию типа, чтобы получался ответ: d=2.941. | |
| Пример вывода: 2.9411764705882355 | |
| */ | |
| public class Solution | |
| { | |
| public static void main(String[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javarush.test.level10.lesson11.home02; | |
| /* Правильный ответ: d=5.5 | |
| Добавить одну операцию по преобразованию типа, чтобы получался ответ: d=5.5. | |
| */ | |
| public class Solution | |
| { | |
| public static void main(String[] args) | |
| { |