Лабы Павловский 2018 / ООП ЛР 1
.docxМИНОБРНАУКИ РОССИИ
Санкт-Петербургский государственный
электротехнический университет
«ЛЭТИ» им. В.И. Ульянова (Ленина)
Кафедра вычислительной техники
отчет
по лабораторной работе №1
по дисциплине «Объектно-ориентированное программирование»
Тема: «Знакомство со средой разработки Java-приложений»
Студент гр. 6307 |
|
Лазарев С. О. |
Преподаватель |
|
Павловский М. Г. |
Санкт-Петербург
2018
СОДЕРЖАНИ
ЦЕЛЬ 3
ЗАДАНИЕ 3
КОНТРОЛЬНЫЙ ПРИМЕР 4
ТЕКСТ ДОКУМЕНТАЦИИ 4
Class Main 4
Field Summary 4
Constructor Summary 5
Method Summary 5
Methods inherited from class java.lang.Object 5
Field Detail 5
Constructor Detail 5
Method Detail 5
ВЫВОДЫ 6
ПРИЛОЖЕНИЕ 7
ЦЕЛЬ 3
ЗАДАНИЕ 3
КОНТРОЛЬНЫЙ ПРИМЕР 4
ТЕКСТ ДОКУМЕНТАЦИИ 4
Class Main 4
Field Summary 4
Constructor Summary 4
Method Summary 5
Methods inherited from class java.lang.Object 5
Field Detail 5
Constructor Detail 5
Method Detail 5
ВЫВОДЫ 6
ПРИЛОЖЕНИЕ 7
ЦЕЛЬ 4
ЗАДАНИЕ 4
КОНТРОЛЬНЫЙ ПРИМЕР 5
ТЕКСТ ДОКУМЕНТАЦИИ 5
Class Main 5
Field Summary 5
Constructor Summary 6
Method Summary 6
Methods inherited from class java.lang.Object 6
Field Detail 6
Constructor Detail 6
Method Detail 6
ВЫВОДЫ 7
ПРИЛОЖЕНИЕ 8
ЦЕЛЬ
Освоение среды разработки Intellij Idea, программирование, запуск и отладка консольного приложения.
ЗАДАНИЕ
Создать приложение, в котором объявить статический массив целых чисел, в методе main проинициализировать этот массив и написать алгоритм его упорядочения по возрастанию. После упорядочения вывести элементы массива в консоль. Используя режим отладки, проанализировать, как в процессе упорядочения меняются значения элементов массива и значение операции сравнения элементов массива. Сгенерировать документацию с помощь Javadoc и просмотреть ее в браузере.
КОНТРОЛЬНЫЙ ПРИМЕР
Экранные формы представлены на рисунке 1.
Рис 1. Экранные формы.
ТЕКСТ ДОКУМЕНТАЦИИ
Class Main
-
java.lang.Object
-
-
Main
-
-
-
public class Main
extends java.lang.Object
Version:
1.1 This is my Main class, here I will write my code
Author:
Sergey Lazarev
-
-
Field Summary
Fields
Modifier and Type
Field
Description
(package private) static int[]
arr
This is our static array
-
Constructor Summary
Constructors
Constructor
Description
Main()
-
Method Summary
All MethodsStatic MethodsConcrete Methods
Modifier and Type
Method
Description
static void
main(java.lang.String[] args)
Here start point of the program
static void
show(int[] arr)
This is function, which show elements of array
-
Methods inherited from class java.lang.Object
-
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Field Detail
-
arr
-
-
static int[] arr
This is our static array
-
Constructor Detail
-
Main
-
public Main()
-
Method Detail
-
main
-
public static void main(java.lang.String[] args)
Here start point of the program
Parameters:
args - comand line values
-
show
public static void show(int[] arr)
This is function, which show elements of array
Parameters:
arr - This is array of elements
ВЫВОДЫ
Я получил навыки работы в среде разработки Java с режимом Debug, научился запускать и отлаживать консольное приложение, делать документацию Javadoc.
ПРИЛОЖЕНИЕ
/** * @author Sergey Lazarev * @version 1.1 * * This is my Main class, here I will write my code */ public class Main { /** * This is our static array */ static int arr[]= {5,6,3,7}; /** * Here start point of the program * @param args comand line values */ public static void main(String[] args) { for (int i = 0; i < arr.length - 1; i++) { for (int j = 0; j < arr.length - i - 1; j++) { boolean check = arr[j] > arr[j + 1]; if (check) { /** * Here use temporary variable to exchange data */ int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } show(arr); } /** * This is function, which show elements of array * @param arr This is array of elements */ public static void show(int arr[]){ for(int i = 0; i < arr.length; i++, System.out.print(" ")){ System.out.print(arr[i]); } } }