Skip to content

Instantly share code, notes, and snippets.

View AlenaAgeeva's full-sized avatar

Full Stack Java Developer AlenaAgeeva

  • Halifax, Canada
View GitHub Profile
@AlenaAgeeva
AlenaAgeeva / Comparing modifiers.java
Created December 12, 2020 21:57
Comparing modifiers
/*
Implement the logic of the isModifierSet method, which checks if the passed allModifiers parameter contains the value of a specific modifier specificModifier.
*/
package com.javarush.task.task21.task2102;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
public class Solution {
public static void main(String[] args) {
@AlenaAgeeva
AlenaAgeeva / network address.java
Created December 12, 2020 21:52
Determine the network address
/*
1. Given the IP address and subnet mask, you need to calculate the network address - implement the getNetAddress method.
Use the bitwise conjunction (logical AND) operation.
Example:
IP address: 11000000 10101000 00000001 00000010 (192.168.1.2)
Subnet mask: 11111111 11111111 11111110 00000000 (255.255.254.0)
Network address: 11000000 10101000 00000000 00000000 (192.168.0.0)
2. Implement the print method, which will output the data in binary code to the console. For IP address (192.168.1.2)
@AlenaAgeeva
AlenaAgeeva / contest ad.java
Created December 12, 2020 20:07
Contest ad
/*
In the main method, replace the System.out object with the wrapper wrapper you wrote.
Your reader wrapper should output contextual ads to the console after every second println.
Call the ready-made printSomething () method, use testString.
Return the original stream to the System.out variable.
Promotional Text: "CodeGym - Online Java Courses"
Output example:
first
@AlenaAgeeva
AlenaAgeeva / Перевертыши.java
Created December 12, 2020 20:04
Перевертыши
/*
1. Считать с консоли имя файла. Считать содержимое файла.
2. Для каждой строки в файле:
2.1. переставить все символы в обратном порядке.
2.2. вывести на экран.
3. Закрыть потоки.
Пример тела входного файла:
я - программист.
Амиго
@AlenaAgeeva
AlenaAgeeva / Long words.java
Created December 12, 2020 19:44
Long words
/*
В метод main первым параметром приходит имя файла1, вторым - файла2.
Файл1 содержит слова, разделенные пробелом.
Записать через запятую в Файл2 слова, длина которых строго больше 6.
В конце файла2 запятой не должно быть.
Закрыть потоки.
Пример выходных данных в файл2:
длинное,короткое,аббревиатура
*/
package com.javarush.task.task19.task1925;
@AlenaAgeeva
AlenaAgeeva / Replacing numbers.java
Created December 12, 2020 19:42
Replacing numbers
/*
1. In the static block, initialize the map dictionary with [number-word] pairs from 0 to 12 inclusive.
For example, 0 - "zero", 1 - "one", 2 - "two"
2. Read the file name from the console, read the contents of the file.
3. Replace all numbers with words using the map dictionary.
4. Display the result on the screen.
5. Close streams.
Sample data in file:
It costs 1 dollar, but this is 12.
@AlenaAgeeva
AlenaAgeeva / Words with numbers.java
Created December 12, 2020 19:40
Words with numbers
/*
In the main method, the first parameter comes the name of file1, the second - file2.
File1 contains lines with words separated by spaces.
Write all words containing numbers, for example, a1 or abc3d, separated by a space into File2.
Close streams.
*/
package com.javarush.task.task19.task1923;
import java.io.*;
import java.util.regex.Matcher;
@AlenaAgeeva
AlenaAgeeva / Ищем нужные строки.java
Created December 12, 2020 19:38
Ищем нужные строки
/*
Считать с консоли имя файла.
Вывести в консоль все строки из файла, которые содержат всего 2 слова из списка words.
Закрыть потоки.
Пример:
words содержит слова А, Б, В
Строки:
В Б А Д //3 слова из words, не подходит
@AlenaAgeeva
AlenaAgeeva / Хуан Хуанович.java
Created December 12, 2020 19:35
Хуан Хуанович
/*
В метод main первым параметром приходит имя файла.
В этом файле каждая строка имеет следующий вид:
имя день месяц год
где [имя] - может состоять из нескольких слов, разделенных пробелами, и имеет тип String.
[день] - int, [месяц] - int, [год] - int
данные разделены пробелами.
Заполнить список PEOPLE используя данные из файла.
Закрыть потоки.
@AlenaAgeeva
AlenaAgeeva / richest.java
Created December 12, 2020 19:33
The richest
/*
The main method receives the file name as the first parameter.
In this file, each line looks like this:
name value
where [name] is String, [value] is double. [name] and [value] are separated by a space.
For each name, calculate the sum of all its values.
Display the names in alphabetical order with the maximum amount to the console.
Separate names with a space or print on a new line.
Close streams.