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.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.home09; | |
| import java.util.HashMap; | |
| import java.util.HashSet; | |
| import java.util.Map; | |
| import java.util.Set; | |
| /* Десять котов | |
| Создать класс кот – Cat, с полем «имя» (String). | |
| Создать словарь Map(<String, Cat>) и добавить туда 10 котов в виде «Имя»-«Кот». |
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.home08; | |
| import java.util.ArrayList; | |
| /* Список из массивов чисел | |
| Создать список, элементами которого будут массивы чисел. Добавить в список пять объектов–массивов длиной 5, 2, 4, 7, 0 соответственно. Заполнить массивы любыми данными и вывести их на экран. | |
| */ | |
| 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.home07; | |
| /* Расставь модификаторы static | |
| Расставь модификаторы static так, чтобы пример скомпилировался. | |
| */ | |
| public class Solution | |
| { | |
| public static int A = 5; | |
| public static int B = 2 * A; |
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.home06; | |
| import java.util.ArrayList; | |
| /* Сказка «Красная Шапочка» | |
| 1. Есть пять классов: красная шапочка, бабушка, пирожок, дровосек, волк. | |
| 2. У каждого класса есть 2 поля: убил (killed ArrayList) и съел (ate ArrayList). | |
| 3. Необходимые объекты созданы (hood, grandmother, ...). | |
| 4. Расставь правильно связи, кто кого съел и убил, чтобы получилась логика сказки «Красная Шапочка». | |
| PS: пирожки никто не ел. Их только несли. Волк чуток поел. А его потом убили. |
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.home05; | |
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| /* Гласные и согласные буквы | |
| Написать программу, которая вводит с клавиатуры строку текста. | |
| Программа должна вывести на экран две строки: | |
| 1. первая строка содержит только гласные буквы | |
| 2. вторая - только согласные буквы и знаки препинания из введённой строки. |
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.home04; | |
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Date; | |
| import java.util.Locale; | |
| /* Конвертер дат | |
| Ввести с клавиатуры дату в формате «08/18/2013» |
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.home03; | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.io.InterruptedIOException; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| /* Метод в try..catch |
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.home02; | |
| /* Обратный отсчёт от 10 до 0 | |
| Написать в цикле обратный отсчёт от 10 до 0. Для задержки иcпользовать Thread.sleep(100); | |
| Обернуть вызов sleep в try..catch. | |
| */ | |
| public class Solution | |
| { | |
| public static void main(String[] args) |