객체배열

반응형

    Node.JS)04.19( ObjectArray(객체 배열), 구조 분해, 배열 요소 추출 )

    목차 2022.04.20 - [Programming/BACKEND] - Node.JS)04.19( Array(배열) : 배열의 요소 추가/제거 방법 ) 1. ObjectArray 객체 배열 1.1. 객체를 배열의 요소로 추가 function Student(name, korean, math, english, science){ this.name = name; this.kor = korean; this.math = math; this.english = english; this.science = science; this.getSum = function(){ return this.kor + this.math + this.english + this.science; } this.getAvg = function(){ ..

    JAVA Basic) 배열 응용 프로그램

    목차 ArrayList를 사용해 '학생 성적 출력 프로그램'을 구현해보자. 이 프로그램은 'Student클래스'와 'Subject클래스'를 사용한다. Subject클래스는 참조 자료형이므로 ArrayList를 활용해 구현해보자. student클래스 구현하기 어떤 학생이 수강하는 과목들의 성적을 출력하는 것이므로 '학생 객체'가 필요. package array; import java.util.ArrayList; public class Student { int studentID; String studentName; ArrayList subjectList; // Student클래스의 멤버 변수들 public Student(int studentID, String studentName) { this.student..

반응형