This lab introduces Kotlin basics and demonstrates how to use regular expressions for text formatting. The goal is to create a program that processes an input string and applies a series of formatting transformations to improve its readability.
The program performs the following operations on the input string:
-
Quote Replacement: replace double quotes (
"
) with proper opening («) and closing (») quotation marks. Opening quotes should precede words, and closing quotes should follow words (including any punctuation). -
Space Normalization: standardize spacing around punctuation. Remove spaces before commas, periods, opening parentheses, etc., and add spaces after commas, periods, closing parentheses, etc.
-
Hyphen Replacement: replace hyphens/dashes with en-dashes surrounded by spaces (unless adjacent to letters).
-
Double Space Removal: replace multiple spaces with single spaces.
" Лето , как обычно ,пролетело незаметно..."-грустно сказал Ваня .Он( и его друзья )сидели на берегу речки с поэтичным названием "Стремительная ".
«Лето, как обычно, пролетело незаметно...» – грустно сказал Ваня. Он (и его друзья) сидели на берегу речки с поэтичным названием «Стремительная».
This lab focuses on the fundamentals of working with Kotlin classes and objects and demonstrates how to implement basic object interactions. The goal is to create a program that simulates the operation of a simple telephone station. The program allows users to manage a list of subscribers and log calls between them.
The program is divided into two main components:
-
Abonent Class
Represents a subscriber with the following properties:- Name and Phone Number
- A call log that stores incoming and outgoing calls.
-
Station Class
Represents the telephone station and includes:- A list of subscribers.
- The ability to initiate calls and log them for both the caller and the recipient.
- A method to display call logs for all subscribers.
-
Adding Subscribers
Subscribers can be added to the station using theaddAbonent()
method. -
Making Calls
Thecall(from: String, to: String)
method simulates a call from one subscriber to another:- Logs an outgoing call in the caller's call log.
- Logs an incoming call in the recipient's call log.
-
Displaying Call Logs
TheshowStat()
method displays the full call logs of all subscribers in a structured format.
fun main() {
val station = Station()
station.addAbonent(Abonent("Иван", "001"))
station.addAbonent(Abonent("Ольга", "002"))
station.addAbonent(Abonent("Сергей", "003"))
station.call("Иван", "Ольга")
station.call("Ольга", "Сергей")
station.call("Сергей", "Иван")
station.call("Иван", "Сергей")
station.call("Ольга", "Иван")
station.showStat()
}
Журнал звонков абонента Иван:
Исходящий к Ольга
Входящий от Сергей
Исходящий к Сергей
Входящий от Ольга
Журнал звонков абонента Ольга:
Входящий от Иван
Исходящий к Сергей
Исходящий к Иван
Журнал звонков абонента Сергей:
Входящий от Ольга
Исходящий к Иван
Входящий от Иван
In the third lab, the focus was on getting acquainted with Android Studio and understanding the process of creating and launching an Android project. The primary objective was to initialize a new project using the Empty Views Activity template, configure the project structure, and familiarize with essential project files such as MainActivity.kt
and activity_main.xml
. Additionally, this lab covered editing the application's manifest file (AndroidManifest.xml
) to include necessary permissions, specifically internet access.
- Text Input and Output, Button, and Listeners
- Activity Lifecycle and GridLayout
- ConstraintLayout
- Resources
- State Preservation, ViewModel, LiveData
- Checkboxes, RadioButtons, Spinners
- Toast and Snackbar Messages, SeekBar
- Debugging and Unit Testing