코딩일상
[JAVA] 입력과 출력 (직장인의 생활코딩 공부일상) 본문
INPUT값이 있으면 프로그램을 통해서 OUTPUT이 나오게 된다
이러한 과정을 어떻게 하면 좀더 유저들이 편하게 하며 실수와
오류가 없을지 알아보았다.
이 수업을 들으면서 다시한번 검색과 서칭 능력의 중요성을 깨달았으며
데이터의 타입과 입력과 아웃푹의 과정이 되는
코드구조를 잘 짜는것이 중요하다는것을 한번더
느꼈다
구글검색 방식
텍스트 입력 박스를 만들기위해
JAVA POPUP input text
string을 double로 변경하기 위해
java string to double
코딩내용
import javax.swing.JOptionPane;
import org.opentutorials.iot.DimmingLights;
import org.opentutorials.iot.Elevator;
import org.opentutorials.iot.Lighting;
import org.opentutorials.iot.Security;
public class OkJavaGoInHomeInput {
public static void main(String[] args) {
String id = JOptionPane.showInputDialog("Enter a ID");
String bright = JOptionPane.showInputDialog("Enter a Bright");
// Elevator call
Elevator myElevator = new Elevator(id);
myElevator.callForUp(1);
// Security off
Security mySecurity = new Security(id);
mySecurity.off();
// Light on
Lighting hallLamp = new Lighting(id+" / Hall Lamp");
hallLamp.on();
Lighting floorLamp = new Lighting(id+" / floorLamp");
floorLamp.on();
DimmingLights moodLamp = new DimmingLights(id+"moodLamp");
moodLamp.setBright( Double.parseDouble(bright));
moodLamp.on();
}
}
'개발 공부 > JAVA' 카테고리의 다른 글
[JAVA]라이브러리?? 내가 볼 땐 제일 중요한개념(직장인의 생활코딩 공부 후기) (0) | 2022.04.17 |
---|---|
[JAVA] 입력(argument)와 매개변수(parameter)의 관계(직장인의 새활코딩 공부기록) (0) | 2022.04.17 |
[JAVA] casting?? 음 그냥 일단 이런게 있구나(직장인 생활코딩 공부 기록) (0) | 2022.04.13 |
[JAVA] 변수의 유용함 + 왜 해야 하는가?? (0) | 2022.04.13 |
[JAVA] 변수의 정의 (직장인의 생활코딩 기록) (0) | 2022.04.13 |