[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();
}
}