Skip to content

Instantly share code, notes, and snippets.

View igorLisovitskiy's full-sized avatar

Igor Lisovitskiy igorLisovitskiy

View GitHub Profile
package com.lisovitskiy.hw5;
public class Book {
private int id;
private static int numberOfBooks = 0;
private String name;
String[] autors;
private String publishingHouse;
private int publishingYear;
private int numberOfPages;
package com.lisovitskiy.hw5;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Library {
private List<Book> books = new ArrayList<Book>();
public void showAllBooks() {
public class Test {
public static void m() {
//some code
}
public static void main(String[] args) {
m(); //этот метод знает что он определен в классе Test, и мы можем не ставить имя класса чтобы уточнить, что именно Test.m() нужно вызвать. как компилятор это понимает?
}
}
class Test2{
package com.lisovitskiy.hw8;
import java.io.*;
import java.nio.*;
import java.nio.file.*;
public class TextEditor {
public static void createFile(String path, String name) {
File file = new File(path + name + ".txt");
FileInputStream fs;// = null;
using System;
using System.Collections.Generic;
class Solver
{
static bool IsEven(int number)
{
return number % 2 == 0;
}
int RoomLength = 6;
int RoomWidth = 2;
int RoomHeigth = 3;
double WallpaperWidth = .5;
int WallpaperLength = 10;
// wallpaper pieces
double numberOfDrops = (6 * 2 + 2 * 2) / 0.5; // two walls by their width = 32
// wallpaper length
ublic static void image()
{
Console.Write("Input Height Of Image:");
int heightIm = Convert.ToInt32(Console.ReadLine());
Console.Write("Input Width Of Image:");
int widthIm = Convert.ToInt32(Console.ReadLine());
if ((0 > heightIm) | (0 > widthIm))
{
Console.WriteLine("Image does not exist");
}
// Пользователь вводит 4-х-значное число, поменять местами 1 с 2 и 3 с 4 цифры. Если число не 4-х значное - вывести сообщение.
using System;
namespace ConsoleApp1
{
class Program
{
public static string Swap(int[] numbers)
{
for (int i = 1; i < numbers.Length; i += 2)
public static void Print2d(int[,] TwoDArray) {
int numOfRows = TwoDArray.GetUpperBound(0) + 1;
int numOfcolumns = TwoDArray.Length / numOfRows;
for (int i = 0; i < numOfRows; i++)
{
for (int j = 0; j < numOfcolumns; j++)
{
Write(TwoDArray[i, j]);
}
public static void Print2d(int[,] TwoDArray) {
int numOfRows = TwoDArray.GetUpperBound(0) + 1;
int numOfcolumns = TwoDArray.Length / numOfRows;
for (int i = 0; i < numOfRows; i++)
{
for (int j = 0; j < numOfcolumns; j++)
{
Write(TwoDArray[i, j]);
}
WriteLine();