Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

이민주: Student 클래스 작성 #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/src/minju/Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package minju;

public class Car {
static Integer WHEEL_COUNT = 4;
private String color;
private String brand;
private Integer maxSpeed;
private Integer currentSpeed;
private String fuel;

public Car(String inputcolor) {
this.color = inputcolor;
this.brand = "테슬라";
this.maxSpeed = 250;
this.fuel = "전기";
this.currentSpeed = 0;
}

public Car(String inputColor, String inputBrand, int maxSpeed, String fuel) {
this.color = inputColor;
this.brand = inputBrand;
this.maxSpeed = maxSpeed;
this.fuel = fuel;
this.currentSpeed = 0;
}

public String 무슨색차니() {
return this.color;
}

public String 무슨브랜드와무슨색을가지고있니() {
return "브랜드는 " + this.brand + " 색은 " + this.color;
}

public void 가속하기() {
this.currentSpeed += 1;
}

public void 감속하기() {
this.currentSpeed -= 1;
}

public Integer 현재속력은() {
return this.currentSpeed;
}


}
31 changes: 31 additions & 0 deletions src/src/minju/Case1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package minju;

import java.util.Scanner;

public class Case1 {
public void gameStart(int randomNum) {
//int : 타입

Scanner sc = new Scanner(System.in);
//Wrpper 클래스: 코드가 작성되있음(1897줄) -> 객체 지향(외부에서 내부 구현 몰라도 된다!)

//그냥 형변환하는 것 구현 하기 힘들기 때문에!
// user_input.floatValue();
// user_input.toString();
String string = "아직 못맞춤";

//string =="아직 못맞춤" 원래는 equals 사용해야하는데 == 도 가능하다!

while (true) {
Integer user_input = Integer.parseInt(sc.nextLine());
if (randomNum < user_input) {
System.out.println("DOWN");
} else if (randomNum > user_input) {
System.out.println("UP");
} else {
System.out.println("GOOD");
break;
}
}
}
}
40 changes: 40 additions & 0 deletions src/src/minju/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package minju;

import java.util.ArrayList;
import java.util.List;

public class Student {
private String name;//이름
private String hobby;//취미
private Integer number;//학번
private Integer grade;//학년
private String school_name;//학교 이름
private String major;//전공
private List<String> subjectList;

private Integer credit;

public Student(String name, String school_name, Integer grade, Integer number, String major, String hobby) {
this.name = name;
this.school_name = school_name;
this.grade = grade;
this.number = number;
this.major = major;
this.hobby = hobby;
this.subjectList = new ArrayList<>();
}


public String 전공이무엇이니() {
return major;
}

public void 과목추가(String subject) {
subjectList.add(subject);
}

public void 학점추가(Integer num) {
this.credit += num;
}

}