Compare commits

...

No commits in common. "main" and "homework4" have entirely different histories.

7 changed files with 24 additions and 237 deletions

26
.gitignore vendored
View File

@ -1,26 +0,0 @@
# ---> Java
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

View File

@ -1,3 +0,0 @@
# javaPractice
Тестовое задание java

View File

@ -1,23 +0,0 @@
import animals.Kotik;
public class Application {
public static void main(String[] args) {
Kotik firstKot = new Kotik("Petr", "hi", 10, 5);
Kotik secondKot = new Kotik();
secondKot.setName("Barsik");
secondKot.setVoice("hello");
secondKot.setSatiety(5);
secondKot.setWeight(3);
for(String str : firstKot.liveAnotherDay()){
System.out.println(str);
}
System.out.println(secondKot.getName());
System.out.println(secondKot.getWeight());
System.out.println(Application.compareVoice(firstKot, secondKot));
System.out.println(Kotik.getCount());
}
public static boolean compareVoice(Kotik firstKot, Kotik secondKot){
return firstKot.getVoice().equals(secondKot.getVoice());
}
}

View File

@ -1,182 +0,0 @@
package animals;
public class Kotik {
private static final int METHODS = 5;
private static int count = 0;
private String name;
private String voice;
private int satiety;
private int weight;
public Kotik(String name, String voice, int satiety, int weight) {
this.name = name;
this.voice = voice;
this.satiety = satiety;
this.weight = weight;
count++;
}
public Kotik() {
count++;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVoice() {
return voice;
}
public void setVoice(String voice) {
this.voice = voice;
}
public int getSatiety() {
return satiety;
}
public void setSatiety(int satiety) {
this.satiety = satiety;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public static int getCount() {
return count;
}
public void eat(int units) {
System.out.println("Kotik is eating");
this.satiety += units;
}
public void eat(int units, String food) {
System.out.println("Kotik is eating " + food);
this.satiety += units;
}
public void eat() {
eat(2, "fish");
}
public boolean play() {
if (satiety > 0) {
System.out.println("Kotik is playing");
satiety--;
return true;
} else {
System.out.println("kotik wanna eat");
return false;
}
}
public boolean sleep() {
if (satiety > 0) {
System.out.println("Kotik is sleeping");
satiety--;
return true;
} else {
System.out.println("kotik wanna eat");
return false;
}
}
public boolean wash() {
if (satiety > 0) {
System.out.println("Kotik is washing");
satiety--;
return true;
} else {
System.out.println("kotik wanna eat");
return false;
}
}
public boolean walk() {
if (satiety > 0) {
System.out.println("Kotik is walking");
satiety--;
return true;
} else {
System.out.println("kotik wanna eat");
return false;
}
}
public boolean hunt() {
if (satiety > 0) {
System.out.println("Kotik is hunting");
satiety--;
return true;
} else {
System.out.println("kotik wanna eat");
return false;
}
}
public String[] liveAnotherDay() {
String[] kotikToDoList = new String[24];
for (int i = 0; i < 24; i++) {
switch ((int) (Math.random() * METHODS) + 1) {
case (1):
if (play())
kotikToDoList[i] =(i + " - play");
else {
eat();
kotikToDoList[i] =(i + " - eat");
}
break;
case (2):
if (sleep())
kotikToDoList[i] =(i + " - sleep");
else {
eat();
kotikToDoList[i] =(i + " - eat");
}
break;
case (3):
if (wash())
kotikToDoList[i] =(i + " - wash");
else {
eat();
kotikToDoList[i] =(i + " - eat");
}
break;
case (4):
if (walk())
kotikToDoList[i] =(i + " - walk");
else {
eat();
kotikToDoList[i] =(i + " - eat");
}
break;
case (5):
if (hunt())
kotikToDoList[i] =(i + " - hunt");
else {
eat();
kotikToDoList[i] =(i + " - eat");
}
break;
default:
System.out.println("something wrong");
break;
}
}
return kotikToDoList;
}
}

View File

@ -0,0 +1,8 @@
task17=^[\d-][.,\de]+$
task18=^[1\(]?\s?(\d{3})[\)\-\s]?\d{3}[\-\s]?\d{4}
task19=^(\w+[.]?\w*)
task20=^<(a|div)
task21=^(\w*)\.(png|jpg|gif)$
task22=^\s*(\b\w*.*\.$)
task23=at\swidget\.List\.(\w*)\((ListView.java):(\d+)\)
task24=^(\w+)://([\w\-\.]+)(?::(\d+))?

View File

@ -0,0 +1,16 @@
task1=abc
task2=123
task3=.*\.
task4=[^drp]an
task5=[^b]og
task6=[A-Z]{1}[a-z]*
task7=waz{3,}up
task8=^a+\w+
task9=^\d+\sfiles?\sfound.
task10=^\d*\.\s+abc
task11=^Mission:\ssuccessful$
task12=^(file.+)\.pdf$
task13=^([JanMayAug]+\s(\d{4}))$
task14=^(\d{3,})x(\d{3,})$
task15=^I\slove\s(cats|dogs)$
task16=^.*\.$

View File

@ -1,3 +0,0 @@
task1= INSERT INTO helpdesk_ticket (title, created, modified, submitter_email, status, on_hold, description, priority, queue_id, secret_key) VALUES ('Ticket for test', CAST('2026-01-19' AS DATE), CAST('2026-01-20' AS DATE), 'some@mail.ru', 2, TRUE, 'test ticket for sql', 1, 1, 1);
task2= update helpdesk_ticket set submitter_email = 'ticketchange@mail.ru' where %s = 77
task3=delete from helpdesk_ticket where %s = 77