This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Велосипед состоит из следующих частей | |
Bike - управляющий класс велосипеда. В нем инкапсулированы детали, из которых состоит велосипед - колеса и руль. Содержит методы | |
run - приводит в движения колеса. После запуска колес оповещает пользователя "Велосипед пришел в движение" | |
stop - останавливает колеса. После остановки колес вывести на консоль "Велосипед остановлен" | |
turn - поворачивает велосипед при помощи руля. Поддерживает повороты с названиями "right", "left", "up". Вывести на консоль сторону поворота. | |
Wheel - колеса велосипеда. Колесо содержит название(заднее и переднее) Содержит метод: | |
rotate - вращение колес. Вывести на консоль "колесо $name начало вращение" | |
stop - остановка колес. Вывести на консоль "колесо $name остановилось" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Реализуйте класс Student (Студент), который будет наследоваться от класса User. Класс должен иметь следующие свойства: | |
yearOfAdmission (год поступления в вуз): инициализируется в конструкторе | |
currentCourse (текущий курс): DateTime.now - yearOfAdmission | |
Класс должен иметь метод toString() , с помощью которого можно вывести: | |
имя и фамилию студента - используя родительскую реализацию toString | |
год поступления | |
текущий курс |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 4 | |
// Напишите функцию решения квадратного уравнения, используя вложенные функции. | |
// Вычисление дискриминанта, нахождение x1 и x2 выполните во вложенных функциях. | |
// Главная функция должна возвращать готовый результат. Функция возвращает ответ в строке (String). | |
import 'dart:math'; | |
void main() { | |
final result = solveQuadraticEquation(1, -2, -3); | |
print(result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 3 | |
// Модернизируйте предыдущие функции так, чтобы на вход они принимали | |
// необходимые данные для работы. Параметр должен быть опциональным. | |
void main() { | |
var a = 'hello world'; | |
reverceText(a); | |
reverceText(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 2 | |
// Создайте и проинициализируйте массив чисел с произвольным размером. Напишите функцию, | |
// которая вычисляет среднее арифметическое число массива и возвращает double результат. | |
// Распечатайте результат в консоли. | |
void main() { | |
const numbers = <int>[11, 23, 44, 2, 65, 100, 32]; | |
print(average(numbers)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 Задание 1(void) | |
// Создайте текстовую переменную a = ‘hello world’; Напишите функцию, без возвращаемого значения. | |
// Функция меняет порядок слов на обратный. Например было ‘hello world’, стало ‘world hello’. | |
void main() { | |
var a = 'hello world'; | |
var b = 'Функция меняет порядок слов на обратный'; | |
reverceText(a); | |
reverceText(b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 4 | |
// Вывести на экран количество одинаковых слов в тексте. | |
void main() { | |
const text = ''' | |
She sells sea shells on the sea shore; | |
The shells that she sells are sea shells I'm sure. | |
So if she sells sea shells on the sea shore, | |
I'm sure that the shells are sea shore shells | |
'''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 3 | |
// Написать программу, которая слушает ввод в консоли, складывает вводимые пользователем числа. | |
// Если пользователь ввел stop, завершить приложение. Если пользователь вводит некорректные | |
// данные - прервать текущую итерацию, начать заново. | |
import 'dart:io'; | |
void main() { | |
var total = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 2 | |
// Используя циклы, напишите программу, которая выводит на консоль все четные числа от 0 до 100. | |
void main() { | |
var buffer = StringBuffer(); | |
for (var i = 0; i <= 100; i++) { | |
if (i.isEven) { | |
buffer.write('$i '); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 1 | |
// Используя switch, напишите программу в методе main(), которая выводит название месяца по номеру от 1 до 12. | |
void main() { | |
const months = <int, String>{ | |
1: 'Январь', | |
2: 'Февраль', | |
3: 'Март', | |
4: 'Апрель', |