Final Exam

Final Exam
– 일시: 2019년 6월 12일 (수) 오전 9:00-10:30
– 장소: 2공 524호
– 범위: 중간고사 포함 – 배운데까지 (수업내용과 과제를 중심으로)

기존 자바1 기말고사 문제 및 답안지 java-final

Java Overview

  • Identifier

naming conventions

  • Variables

local vs class variable, instance vs static variable

  • Data Type

primitive vs reference data type

  • Type Conversion

implicit vs explicit type conversion
int <-> String conversion
numeric data type conversion

  • Operator

arithmetic vs relational vs bitwise vs logical vs assignment operator
operator precedence
postfix vs prefix increment/decrement operator

  • Control Statement

if/else, switch, for/foreach, while/do-
while, break/continue

  • Array

Integer Array
Person Array
2D Array
returning an array vs passing an array as parameter

  • Enum

enum data type
enum Operation example
enum Operator, enum Gender, enum Weekday

  • Method

parameter passing (pass-by value – primitive vs reference data type)
swap
method overloading vs overriding

  • Class

Person Class
default/public/protected/private
Static vs Instance Initializer Block
constructor usage guideline
singleton design pattern vs static class
ValueClass instance vs static
BankAccount instance vs static
Person instance vs static
PersonContactTest (has-a PhoneNumber)
ArithmeticCalculator (has-a Value & ArithmeticOperator)

  • Inheritance

BankAccount SavingAccount CheckingAccount class(instance vs static member)
Car Sedan class (default/public/protected/private)
Person Student class (instance vs static method overriding)

  • Polymorphism

Polymorphism vs Method Overriding vs Method Overloading
Abstract Class & Abstract Method & Polymorphism

  • Interface

Comparable & Comparator Interface
Shape Polymorphism with Interface

  • Collections

autoboxing and unboxing
Equals vs Contains
== vs equals vs hashCode vs contains
Array vs ArrayList
Difference between Array and ArrayList

  • Swing

Swing Component
Layout Manager
5 Ways to Implement Event Listener
Event Listener (ChangeListener, KeyListener, ActionListener)
Key & Mouse Motion Listener & Adapter
TemperatureConverter
MetricConverter
AridityIndex
BMICalculator
TripleCalculatorFrame
Custom Component
DrawingPanel
BodyCalculator

BodyCalculator

BodyCalculatorEx (template) – add button click event handler to calculate bmi/bmr/bfp
BodyCalculatorFrame (completed)

BMI (Body Mass Index) https://bmi-calories.com/bmi-calculator.html

BMR (Basal Metabolic Rate) https://bmi-calories.com/bmr-calculator.html

BFP (Body Fat Percentage) https://bmi-calories.com/body-fat-percentage-calculator.html

 

Lab8

java1-lab8

Lab8 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (2~3장)를 넣고 Lab8_학번_이름.zip 압축한 후 e-learning(http://lms.dankook.ac.kr/index.jsp)으로 제출 (Due by 6/10)

Lab8 SWING GUI

figure package – Area, Perimeter, Vector2D, Bound, Figure, Triangle, Quadrilateral, Trapezoid, Parallelogram, Kite, Rhombus, Rectangle, Square

DrawPanel사용자가 마우스 더블클릭으로 점을 찍어 삼각형/사각형 도형 그리기

TriangleFrame 클래스 – 삼각형의 종류를 판별(combobox)하고 삼각형의 면적(textfield)과 둘레(textfield)를 출력

QuadrilateralFrame 클래스 – 사각형의 종류를 판별(combobox)하고 삼각형의 면적(textfield)과 둘레(textfield)를 출력

Lab8 클래스 – TriangleFrame과 QuadrilateralFrame 클래스 호출

-ArrayList<Figure> figureList
-그리고, 사용자가 도형의 점을 입력하여 삼각형/사각형 도형을 판별하고 도형의 면적과 둘레를 계산한다.

JPanel panel = new JPanel(new BorderLayout());

JPanel drawPanel = new DrawingPanel(3); // triangle drawPanel
JPanel panel2 = new JPanel(new FlowLayout());

panel.add(drawPanel, BorderLayout.CENTER);
panel.add(panel2, BorderLayout.SOUTH);

 

Lab7

java1-lab7(updated)
Lab7 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (2~3장)를 넣고 Lab7_학번_이름.zip 압축한 후 e-learning(http://lms.dankook.ac.kr/index.jsp)으로 제출 (Due by 5/28 연장)

Lab7 package & import & ArrayList & triangle classification & quadrilateral classification

도형의 점을 입력하여 삼각형/사각형 도형을 판별하고 도형의 면적과 둘레를 계산한다.

Lab7 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (2~3장)를 넣고 Lab7_학번_이름.zip 압축한 후 e-learning(http://lms.dankook.ac.kr/index.jsp)으로 제출 (Due by 5/31 연장)

Lab7 package & import & ArrayList & triangle classification & quadrilateral classification

Triangle 클래스

-TriangleType classify()

-TriangleType classifyByAngle()

Quadrilateral 클래스

-QuadrilateralType classify()

-Quadrilateral 클래스의 area()

Lab7 클래스

-ArrayList<Figure> figureList
-그리고, 사용자가 도형의 점을 입력하여 삼각형/사각형 도형을 판별하고 도형의 면적과 둘레를 계산한다.

 

private static final Point[] triangle1 = { new Point(10, 0), new Point(0, 10), new Point(10, 10) };
private static final Point[] triangle2 = { new Point(5, 0), new Point(0, 10), new Point(10, 10) };
private static final Point[] triangle3 = { new Point(7, 0), new Point(0, 5), new Point(5, 5) };
private static final Point[] triangle4 = { new Point(5, 0), new Point(0, 10), new Point(5, 5) };
private static final Point[] triangle5 = { new Point(7, 0), new Point(0, 5), new Point(5, 10) };
private static final Point[] rectPoints1 = { new Point(0, 0), new Point(0, 20), new Point(30, 20), new Point(30, 0) };
private static final Point[] rectPoints2 = { new Point(10, 0), new Point(0, 10), new Point(20, 30), new Point(30, 20) };
private static final Point[] squarePoints1 = { new Point(0, 0), new Point(0, 20), new Point(20, 20), new Point(20, 0) };
private static final Point[] squarePoints2 = { new Point(0, 20), new Point(20, 40), new Point(40, 20), new Point(20, 0) };
private static final Point[] trapezoidPoints1 = { new Point(10, 0), new Point(0, 20), new Point(30, 20), new Point(20, 0) };
private static final Point[] trapezoidPoints2 = { new Point(0, 10), new Point(0, 30), new Point(10, 40), new Point(10, 0) };
private static final Point[] trapezoidPoints3 = { new Point(0, 10), new Point(20, 30), new Point(30, 20), new Point(20, 10) };
private static final Point[] trapezoidPoints4 = { new Point(0, 0), new Point(10, 30), new Point(30, 30), new Point(10, 0)};
private static final Point[] parPoints1 = { new Point(10, 0), new Point(0, 20), new Point(20, 20), new Point(30, 0) };
private static final Point[] parPoints2 = { new Point(10, 10), new Point(30, 10), new Point(20, 0), new Point(0, 0) };
private static final Point[] parPoints3 = { new Point(0, 10), new Point(20, 30), new Point(40, 20), new Point(20, 0) };
private static final Point[] rhombusPoints1 = { new Point(10, 0), new Point(0, 20), new Point(10, 40), new Point(20, 20) };
private static final Point[] rhombusPoints2 = { new Point(20, 0), new Point(0, 10), new Point(20, 20), new Point(40, 10) };
private static final Point[] kitePoints1 = { new Point(10, 0), new Point(0, 10), new Point(10, 40), new Point(20, 10)};
private static final Point[] kitePoints2 = { new Point(10, 0), new Point(0, 10), new Point(10, 20), new Point(40, 10)};