Skip to content

Instantly share code, notes, and snippets.

@P0huber
P0huber / HowAreManyDaysInYear
Created June 29, 2017 05:29
Определение сколько дней в любом году. Description how are many days in any year [Java]
/*
Quantity days in a year
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter any year: ");
int x = Integer.parseInt(br.readLine());
String s = "Quantity days in this year: 36";
@P0huber
P0huber / balance
Created June 26, 2017 18:39
Расчет остатка секунд последнего часа от введенного значения с проверкой. Calculation of remainder seconds of last hour [Java].
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter any number seconds: ");
int n = s.nextInt(); // entering the any whole number
System.out.println("We have " + getCountSecondsPassedInCurrentHour(n) + " seconds of the last hour."); // call of function with the value
System.out.println("And it`s exactly: " + n / 3600 + " hours and " + n % 3600 + " seconds.");
}
@P0huber
P0huber / multipltable
Created June 24, 2017 14:39
Реализация таблицы умножения 10х10. Implementation of the multiplication table 10x10 on Java.
public static void Base (int a){ // The creating of the function: printing string ever 10 values.
for (int i = 1; i < 11; i++){ // The declaring of the cycle calculation of string values have been multiplying on the one particular number.
System.out.print(a * i + " "); // The printing of the result multiplication with a space.
}
}
public static void main(String[] args) {
int y = 1;
for (int x = 1; x < 11; x++){
Base(y); // Call the function
@P0huber
P0huber / IdentificationTypeOfNumber.java
Created July 2, 2017 13:25
Определение введенного числа. Identification of the entered number.
package com.javarush.task.task04.task0427;
/*
Описываем числа
*/
import java.io.*;
public class IdentificationTypeOfNumber {
private static void findCapacity(short x){
if(x > 0 && x < 10)
@P0huber
P0huber / CanvasOfLetters.java
Last active July 3, 2017 10:59
Создание полотна 10х10 из букв. The creation of letter canvas 10x10 [Java]
public class CanvasOfLetters {
private static String whileCycle(String s){
int a = 1;
while (a < 10) {//The creating of row containing 10 letters "S"
System.out.print(s);
a++;
}return s;
}
public static void main(String[] args) throws Exception {
int a = 1;
@P0huber
P0huber / StopWordSum.java
Created July 15, 2017 11:46
Calculation sum digits till didn`t entered stop-word. Вычисление суммы цифр пока не введено с клавиатуры стоп слово [Java].
package com.javarush.task.task05.task0529;
/*
Консоль-копилка
*/
import java.io.*;
public class StopWordSum {
public static void main(String[] args) throws Exception {//напишите тут ваш код
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
@P0huber
P0huber / LongestString.java
Last active August 17, 2017 01:18
Finding a longest String. Нахождение самой длинной строки [Java]
package com.javarush.task.task07.task0708;
import java.io.*;
import java.util.ArrayList;
/*
Самая длинная строка
*/
public class LongestString {
@P0huber
P0huber / ConversionOfIntegers.java
Created August 17, 2017 18:06
Conversion of Integers. Преобразование целых типов [Java]
package com.javarush.task.task10.task1004;
/*
Задача №4 на преобразование целых типов
*/
public class ConversionOfIntegers {
public static void main(String[] args) {
short number = 9;
char zero = '0';
@P0huber
P0huber / InsideForEach.java
Created August 17, 2017 01:01
Method in for...each. Метод в for...each [Java]
package com.javarush.task.task09.task0921;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
/*
Метод в try..catch
*/
@P0huber
P0huber / WorkWithHashSet2.java
Created August 6, 2017 13:12
Creation HashSet and removal elements according to the condition. Создание HashSet и удаление элементов в нем [Java]
package com.javarush.task.task08.task0814;
import java.util.HashSet;
import java.util.Iterator;
/* OPTION 2
Больше 10? Вы нам не подходите
*/