WeatherIndex


// 체감온도값 = 13.12 + 0.6215*T - 11.37 * V^0.16 + 0.3965 * V^0.16 * T [ T: 기온(섭씨), V : 풍속(km/h) ]
public static double calculate(double T, double W) {
	double V = fromMStoKMH(W);
	double value = 0.0;
	if (V > 4.8) {
		value = 13.12 + 0.6215*T - 11.37 * Math.pow(V, 0.16) + 0.3965 * Math.pow(V, 0.16) * T;
		if (value > T) {
			value = T;
		}
	}
	else {
		value = T;
	}
	value = Math.round(value);
	return value;
}

// 열지수값 = -42.379 + (2.04901523*F) + (10.14333127*R) - (0.22475541*F*R) - (0.00683770*F*F) - (0.05481717*R*R) + (0.00122874*F*F*R) + (0.00085282*F*R*R) - (0.00000199*F*F*R*R) [F: 화씨온도, R: 상대습도]
public static double calculate(double T, double R) {
	double F = fromCelsiusToFahrenheit(T);
	double value = -42.379 + (2.04901523*F) + (10.14333127*R) - (0.22475541*F*R) - (0.00683770*F*F) - (0.05481717*R*R) + (0.00122874*F*F*R) + (0.00085282*F*R*R) - (0.00000199*F*F*R*R);	
	double adj = 0.0;
	if (R < 13.0 && F >= 80.0 && F <= 112.0) { adj = 0.25 * (13.0 - R) * Math.sqrt((17.0 - Math.abs(F - 95.0)) / 17.0); } if (R > 85.0 && F >= 80.0 && F <= 87) {
		adj = (R - 85.0)/10.0 * (87.0 - F) / 5.0;
		value += adj;
	}
	if (F < 80.0) {
		value = F;
	}
	value = fromFahrenheitToCelsius(value); // (celsius)
	value = Math.round(value * 10) / 10.0; // 소수점 첫째자리 반올림
	return value;
}

// 부패지수값 = (RH - 65)/14 * (1.054^T) [RH: 상대습도 (%), T: 기온 (섭씨)]
public static double calculate(double T, double RH) {
	double value = (RH - 65.0)/14.0 * Math.pow(1.054, T);
	value = Math.round(value * 100) / 100.0; // 소수점 두째자리 반올림

	return value;
}

Lab3

Lab3 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (3~4장)를 넣고 JAVA20-2_Lab3_학번_이름.zip 압축한 후 제출 (due by 10/5)

java2-lab3 (lab3-template을 이러닝에서 받아서 사용하세요.)

week5-lab3 동영상을 참고하세요.

Lab2

Lab2 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (3~4장)를 넣고 JAVA20-2_Lab2_학번_이름.zip 압축한 후 제출 (due by 9/29)
java2-lab2

week4-lab2 동영상을 참고하세요.

 

Lab1

Lab1 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (3~4장)를 넣고 JAVA20-2_Lab1_학번_이름.zip 압축한 후 제출 (due by 9/22 => 9/29까지 연장)
java2-lab1

week3-lab1 동영상을 참고하세요.

SOLID

Single-responsibility principle
A class should only have a single responsibility, that is, only changes to one part of the software’s specification should be able to affect the specification of the class.

Open–closed principle
“Software entities … should be open for extension, but closed for modification.”

Liskov substitution principle
“Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” See also design by contract.

Interface segregation principle
“Many client-specific interfaces are better than one general-purpose interface.”

Dependency inversion principle
One should “depend upon abstractions, [not] concretions.”

https://en.wikipedia.org/wiki/SOLID
https://medium.com/@mari_azevedo/s-o-l-i-d-principles-what-are-they-and-why-projects-should-use-them-50b85e4aa8b6