Skip to content

Sharibo-EPAM-BelSUT-Training/task01_alternative

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

task01_alternative

First task in EPAM BelSUT Training. Alternative version.

I used classes, interfaces, fields, methods, enumeration. I also learned how to work with collections and arrays. I created documentation comments and generated a javadoc. In the end I built a jar-file.

I executed this variant in the form of a dialogue of a console program with a "girl". My idea was: more user interaction, programming shouldn't be boring!

Attention: the program is in Russian.


↓ How it works ↓

Basically, the program corresponds to task01, but the Main.java class is an infinite while-loop. Inside the loop, there are many switch-case and if-else branches for implementing a dialogue with the user, the main purpose of which is to determine the user's response options, execute the corresponding code and output the result to the console.

GIF-preview

In case of irrelevant input, the branches are traversed without finding a match and a new iteration of the infinite loop begins. The infinite loop is interrupted by typing the word "выход", which sets the loop flag = boolean to false. This completes the program.

Usage:

In releases, you can download this program ( .jar-file) and "play" it. Because the program is in Russian, first you need to enable support for Russian input in the console, then start the program itself. Further input takes place on the Russian keyboard layout.

For Windows:

chcp 1251
java -jar task01_alternative.jar

Or, more simply, you can run the program using this script in releases: task01_alternative.bat.



task01_alternative

Первая лабораторная в Тренинге ЕПАМ при БелГУТе. Альтернативная версия.

Я использовал классы, интерфейсы, поля, методы, перечисление. Я также научился работать с коллекциями и массивами. Я оформил документирующие комментарии и сгенерировал javadoc. В конце я собрал jar-file.

Я оформил этот вариант в виде диалога консольной программы с «девушкой». Моя идея заключалась в следующем: больше взаимодействия с пользователем, программирование не должно быть скучным!

Внимание: программа на русском языке.


↓ Как это работает ↓

В основном программа соответствует task01, но основной Main.java класс выполнен в виде бесконечного while-цикла. Внутри цикла есть много ветвлений switch-case и if-else для реализации диалога с пользователем, основная цель которых — определить варианты ответа пользователя, выполнить соответствующий код и вывести результат в консоль.

GIF-превью

В случае нерелевантного ввода ветвления не находят совпадений и просто начинается новая итерация бесконечного цикла. Бесконечный цикл прерывается вводом слова «выход», что переключает флаг цикла = булевую переменную в значение false. Таким образом завершается выполнение программы.

Запуск:

В разделе релизов можно скачать данную программу и "сыграть" в неё. Т.к. программа на русском языке, для начала требуется включить поддержку русского ввода в консоли, уже после запустить саму программу. Дальнейший ввод производится на русской раскладке клавиатуры. Для Windows:

chcp 1251
java -jar task01_alternative.jar

Или более просто запустить программу можно с помощью скрипта, также в разделе релизов: task01_alternative.bat.