JAVA/문제풀이

2022_10_25 알림창 띄우기

0304호 2022. 10. 25.
package util;

import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;

public class test  {
	public static void main(String[] args) {
		// TODO 자동 생성된 메소드 스텁
		Date currentTime = new Date();
		JOptionPane time =new JOptionPane();
		
		SimpleDateFormat now = new SimpleDateFormat("MM dd E요일 h시 mm분");
		
		while(currentTime.getHours() <=18) {
			currentTime = new Date();
			if	      ((currentTime.getHours() == 12 && currentTime.getMinutes() >= 50 && currentTime.getMinutes() <= 59)   
					|| (currentTime.getHours() == 13 && currentTime.getMinutes() >= 00 && currentTime.getMinutes() <= 59)) {
				time =new JOptionPane();
				JOptionPane.showMessageDialog(null, "점심시간");
				break;
			}else if  (currentTime.getMinutes() >= 50 
					&& currentTime.getMinutes() <= 59  ) {
				time =new JOptionPane();
				JOptionPane.showMessageDialog(null, "쉬는시간");
				break;

			}else {
				time =new JOptionPane();
				JOptionPane.showMessageDialog(null, now.format(currentTime));
//				break;
			}
		}


	}
}
//로또생성
//for( int i = 0 ; i < 5 ; i++) {
//	System.out.println(r.nextInt(45)+1);
//}

//JOptionPane.showMessageDialog(null, "에러 메시지", "ERROR_MESSAGE", JOptionPane.ERROR_MESSAGE);

댓글