실습 예제

    [자바/JAVA] 프로그래밍 - 종합 예제 (도서관 프로그램)

    Book Class package com.kh.library.model.vo; public class Book { private String bNo; private String title; private String author; private String publisher; private int price; private String description; public Book() {} // 단축키로 생성해보기 public Book(String bNo, String title, String author, String publisher, int price, String description) { super(); this.bNo = bNo; this.title = title; this.author = au..

    [자바/JAVA] 프로그래밍 - 종합 예제(MVC)

    MVC패턴 : 각 클래스마다 역할을 부여해서 작업(데이터, 화면, 요청처리)을 부여해서 작업 => 유지보수 용이하다 - M(Model) : 데이터를 담당하는 역할(데이터를 담기위한 클래스, 비즈니스 로직 처리하기 위한 클래스, 데이터가 보관되어 있는 보관함과 연결해서 입출력) - V(view) : 화면을 담당하는 역할 즉, 사용자에게 보여지는 시각적인 요소 (출력문(print), 입력문(Scanner)) - C(controller) : 사용자가 요청한 내용을 처리한 후 그 결과를 돌려주는 역할 (출력문 같은 거 안쓸꺼임!!) 예제) 메뉴 1. 새로운 곡 추가 2. 곡 전체 조회 3. 특정곡 삭제 4. 특정곡 검색 5. 특정곡 수정 0. 프로그램 종료 Music Class package com.kh.cha..

    [자바/JAVA] 프로그래밍 - 컬렉션(Collection) 실습 예제

    [문제 1] 다음과 같은 조건을 만족하는 프로그램을 작성 하시오 Dog Class package com.kh.practice.list.model.vo; public class Dog { private String name; private int age; private String kind; public Dog() { } public Dog(String name, int age, String kind) { super(); this.name = name; this.age = age; this.kind = kind; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int ..

    [자바/JAVA] 프로그래밍 - API_실습 문제 (2)

    [문제 1] 다음과 같은 조건을 만족하는 프로그램을 작성 하시오. Book Class package com.kh.practice.api.model.vo; import java.text.SimpleDateFormat; import java.util.Date; public class Book { private String title; private String author; private String publisher; private Date publishDate; private int price; public Book() { } public Book(String title, String author, String publisher, Date publishDate, int price) { this.title..

    [자바/JAVA] 프로그래밍 - API_실습 문제 (1)

    TokenMenu Class package com.kh.practice.token.view; import java.util.Scanner; import com.kh.practice.token.controller.TokenController; public class TokenMenu { private Scanner sc = new Scanner(System.in); private TokenController tc = new TokenController(); public void mainMenu() { while(true) { //1. 지정 문자열 ➔ tokenMenu() System.out.println("1. 지정문자열"); //2. 입력 문자열 ➔ inputMenu() System.out.println..

    [자바/JAVA] 프로그래밍 - 상속 (inheritance) 실습 문제_2

    [상속 실습문제2] 다음과 같은 조건을 만족하는 프로그램을 작성 하시오 도형의 x,y 좌표 값과 각 도형의 면적, 둘레를 계산하는 프로그램이다. 해당 구현 클래스 다이어그 램과 클래스의 구조를 참고하여 프로젝트를 완성하시오. Point Class package com.hw2.model.vo; public class Point { private int x; private int y; public Point() { } public Point(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } publi..

    [자바/JAVA] 프로그래밍 - 상속 (inheritance) 실습 문제_1

    [상속 실습문제1] 다음과 같은 조건을 만족하는 프로그램을 작성 하시오 학생과 직원을 관리하는 프로그램으로 상속 구조를 통해 구현해보시오. 해당 클래스 다이어그램 과 클래스 구조를 참고하여 프로젝트를 완성하시오 Person Class package com.hw1.model.vo; public class Person { protected String name; private int age; private double height; private double weight; public Person() { } public Person(int age, double height, double weight) { this.age = age; this.height = height; this.weight = weight..

    [자바/JAVA] 프로그래밍 - 객체(Object) 실습 예제

    Product Class package com.hw1.model.vo; public class Product { //필드부 private String productId;// 상품아이디 private String productName;// 상품명 private String productArea; private int price; private double tax; // 생성자부 (기본 + 전체) // 기본 생성자 public Product() { } // 전체 생성자 (매개변수 생성자) public Product(String productId, String productName, String productArea, int price, double tax) { this.productId = productId..