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

basic : class수업 #40

Open
wants to merge 1 commit 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
3 changes: 3 additions & 0 deletions src/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added src/out/production/spartaSpringBasic/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions src/spartaSpringBasic.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
24 changes: 21 additions & 3 deletions src/src/Main.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import base.Case1;
import younggyu.Car;
import younggyu.Case1;

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

public class Main {
public static void main(String[] args) {
Case1 case1 = new Case1();
List<Car> carList = new ArrayList<>();


Car blueCar = new Car("파란 차");
Car blackCar = new Car("검정색 차");

for(Integer i = 0; i < 10; i++){
blueCar.가속하기();
}


carList.add(blueCar);
carList.add(blackCar);

case1.gameStart(3);
for(Car car : carList){
System.out.println(car.무슨색차니() +"색 차의 현재 속력은 : " + car.현재속력은());

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

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 = "전기";
currentSpeed = 0;
}

public Car(String inputColor, String inputBrand, Integer maxSpeed, String fuel){
this.color = inputColor;
this.brand = inputBrand;
this.maxSpeed = maxSpeed;
this.fuel = fuel;
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;
}

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

public class Computer {

}