객체지향프로그래밍 과제 보고서 및 코드 (JAVA, 영문 보고서, 코드(.java) 전체 포함)
- 최초 등록일
- 2019.04.10
- 최종 저작일
- 2012.06
- 8페이지/ 압축파일
- 가격 1,000원
소개글
Shape, Rectangle, ColoredRectangle 클래스를 정의하는 과제입니다.
Rectangle class는 Shape를, ColoredRectangle class는 Rectangle class를 extends하고 있으며, 값에 따라 해당 사각형을 출력하는 코드까지 포함되어 있습니다.
각 클래스의 .java 파일 뿐만 아니라 main 클래스가 정의되어 있는 .java 파일까지 전부 포함되어 있으며, 보고서는 영문으로 작성되어 있습니다.
목차
1. SHAPE CLASS
2. RECTANGLE CLASS
3. COLORRECTANGLE CLASS
4. MAIN CLASS
5. OUTPUT WINDOW
6. CODES
A. SHAPE CLASS CODE
B. RECTANGLE CLASS CODE
C. COLORRECTANGLE CLASS CODE
D. MAIN CLASS CODE
본문내용
Shape class’s data members are width and height. These data members are only accessible by inherited class, so I defined these data members “protected”.
Constructors are 3 types: with no parameter, with one integer parameter, and with two integer parameters. First, constructor with no parameter sets width and height to 0. So I use “this”: this(0, 0); Second, constructor with one integer parameter sets width and height to this parameter value, and I defined the parameter width, so I write this(width, width); for calling another constructor. Last is constructor with two integer parameters. This constructor sets width and height to each parameter values, so the code is like this: public Shape(int width, int height){ this.width = width; this.height = height;} This constructor is called another constructor uses “this”.
At last, look at the public methods. Shape class defined total 5 public methods: dimensions, getWidth, setWidth, getHeight, setHeight.
참고 자료
없음
압축파일 내 파일목록
ColorRectangle.java
Homework 3.docx
HW3_main.java
output_window.jpg
Rectangle.java
Shape.java