/* Abreu, Dianne
 * Apo, Andrea
 * Gardose, Zanetha
 * Manuel, Jezariel
 * Ouano, Genisha
 * Padan, Rheiva
 * Sepian, Rogelyn
 * Tupaen, Vivien
 * Faypon, Jeremy
 */
import java.util.Scanner;
import javax.swing.*;
class newspaper

{
	public static void main(String args[])
	{
		Scanner x=new Scanner(System.in);
		Scanner input=new Scanner(System.in);
		JOptionPane.showMessageDialog(null,"Welcome!\n");
		int doItAgain = 1;
		while(doItAgain ==1){
			try{
			int a,b,c,d=0,e,i,j,k,l,m,n;
			String f,g,h;
			String Convert;
			a = Integer.parseInt(JOptionPane.showInputDialog("Choices: \n\t\t[1]-Daily Newspaper\n\t\t[2]-Weekly Newspaper\nChoose the kind of newspaper you want to reserve?: " ));
			while(a>2||a<1)
			{
			a = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\n Please choose from the following only. \n 1-Daily Newspaper, 2-Weekly Newspaper \nChoose the kind of newspaper you want to reserve?: "));
			}
			if(a==1)
			{
	
			b = Integer.parseInt(JOptionPane.showInputDialog("-----------DAILY NEWSPAPER-----------\n\n\t\tChoices: \n\t\t[1]-Manila Bulletin\n\t\t[2]-Daily Inquirer\n\t\t[3]-Philippine Star\n\t\tChoose the type of newspaper you want to reserve?: "));
				while(b>3||b<1)
				{
			b = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice! \n Please choose from the following only.\n\t\t[1]-Manila Bulletin\n\t\t[2]-Daily Inquirer\n\t\t[3]-Philippine Star\n\t\tChoose the type of newspaper you want to reserve?: "));			
				}
				switch(b)
				{
	
					case 1:
						{
							c = Integer.parseInt(JOptionPane.showInputDialog("-----------MANILA BULLETIN-----------\nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));						
							while(c>7||c<1)
								{
									c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?: "));	
								}
							if(d==0)
							{
								e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?:  "));	
								if(e==1)
								{
									d=d+1;
									JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
									f = JOptionPane.showInputDialog("Name: ");
									g = JOptionPane.showInputDialog("Year: ");
									h = JOptionPane.showInputDialog("Section: ");	
									JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");								
								}
							}
	
							break;
						}
						
					case 2:
						{
							c = Integer.parseInt(JOptionPane.showInputDialog("-----------DAILY INQUIRER----------- \nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?:  "));	
							while(c>7||c<1)
								{
									c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday.\nChoose the day of the newspaper you want to reserve?: "));	
								}
							if(d==0)
							{
								e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?:  "));	
								if(e==1)
								{
									d=d+1;
									JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
									f = JOptionPane.showInputDialog("Name: ");
									g = JOptionPane.showInputDialog("Year: ");
									h = JOptionPane.showInputDialog("Section: ");	
									JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");								
								}
							}
							break;
						}
	
					case 3:
						{
							c = Integer.parseInt(JOptionPane.showInputDialog("-----------PHILIPPINE STAR-----------\nChoose from the following days:\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday \nChoose the day of the newspaper you want to reserve?: "));	
							while(c>7||c<1)
								{
									c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only\n\n\t\t\t[1]-Monday\n\t\t\t[2]-Tuesday\n\t\t\t[3]-Wednesday\n\t\t\t[4]-Thursday\n\t\t\t[5]-Friday\n\t\t\t[6]-Saturday\n\t\t\t[7]-Sunday\nChoose the day of the newspaper you want to reserve?:  "));	
								}
							if(d==0)
							{
								e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?:  "));	
								if(e==1)
								{
									d=d+1;
									JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
									f = JOptionPane.showInputDialog("Name: ");
									g = JOptionPane.showInputDialog("Year: ");
									h = JOptionPane.showInputDialog("Section: ");	
									JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");								
								}
							}
							break;
						}
				}//switch
			}//if
			if(a==2)
			{
				b = Integer.parseInt(JOptionPane.showInputDialog("-----------WEEKLY NEWSPAPER----------- \nChoices: \n\t\t\t[1]-Cordillera Today\n\t\t\t[2]-Midland Courier\nChoose the type of newspaper you want to reserve?: "));	
				while(b>2||b<1)
				{
					b = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice! \n Please choose from the following only. \n\t\t\t[1]-Cordillera Today\n\t\t\t[2]-Midland Courier\nChoose the type of newspaper you want to reserve?: "));
				}
	
					switch(a)
					{
						case 1:
						{
						c = Integer.parseInt(JOptionPane.showInputDialog("-----------CORDILLERA TODAY----------- \nChoose from the following weeks: \n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
	
						while(c>4||c<1)
							{
								c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
							}
							if(d==0)
							{
								e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?:  "));	
								if(e==1)
								{
									d=d+1;
									JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
									f = JOptionPane.showInputDialog("Name: ");
									g = JOptionPane.showInputDialog("Year: ");
									h = JOptionPane.showInputDialog("Section: ");	
									JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");								
								}
							}
						}
						case 2:
						{
							c = Integer.parseInt(JOptionPane.showInputDialog("-----------MIDLAND COURIER-----------\nChoose from the following weeks: \n\t\t\t[1]-Week 1\n\t\t\t[2]-Week 2\n\t\t\t[3]-Week 3\n\t\t\t[4]-Week 4\nChoose the week of the newspaper you want to reserve?: "));
	
							while(c>4||c<1)
							{
								c = Integer.parseInt(JOptionPane.showInputDialog("Invalid choice!\nPlease choose from the following only.\n 1-Week 1, 2-Week 2, 3-Week 3, 4-Week 4 \nChoose the week of the newspaper you want to reserve?: "));
							}
							if(d==0)
							{
								e = Integer.parseInt(JOptionPane.showInputDialog("Choices:\n\t\t\t[1]-Yes\n\t\t\t[2]-No\nDo you really want to reserve the newspaper?:  "));	
								if(e==1)
								{
									d=d+1;
									JOptionPane.showMessageDialog(null,"Kindly fill-up the needed information:");
									f = JOptionPane.showInputDialog("Name: ");
									g = JOptionPane.showInputDialog("Year: ");
									h = JOptionPane.showInputDialog("Section: ");	
									JOptionPane.showMessageDialog(null,"Thank You,"+f+" of "+h+" from school year "+"["+g+"]"+" You have succesfully reserved the newspaper,");								
								}
							}
						}
					}//switch
				}//if
				doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Want TO Try Again? : \n Input 1 to try again \n Input 0 to terminate the Program"));
				while(doItAgain!=1&&doItAgain!=0)
				{
					doItAgain = Integer.parseInt(JOptionPane.showInputDialog("Error!? : \n Input 1 to try again \n Input 0 to terminate the Program"));
				}
			}catch(Exception error){
				System.exit(0);
			}
		}//loop

		}
	}
