import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class HotelManagement extends JFrame implements ActionListener
{ JLabel tekst1=new JLabel("Name ");
JTextArea intekst1= new JTextArea(1,7);
JLabel tekst2=new JLabel("Surname ");
JTextArea intekst2= new JTextArea(1,7);
JPanel tekst1Panel= new JPanel();
JPanel tekst2Panel= new JPanel();
JTextArea ana= new JTextArea(2,25);
JRadioButton couple=new JRadioButton("Couple room");
JRadioButton one=new JRadioButton("One person");
ButtonGroup choiceGroup= new ButtonGroup();
JButton save= new JButton("Save");
public HotelManagement()
{super ("Hotel Management");
setSize(350,250);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
choiceGroup.add(dhomaCift);
choiceGroup.add(dhomaTek);
JPanel choicePanel= new JPanel();
choicePanel.setLayout(new BoxLayout(choicePanel,BoxLayout.Y_AXIS));
choicePanel.add(dhomaCift);
choicePanel.add(dhomaTek);
Container content= getContentPane();
FlowLayout lay=new FlowLayout(FlowLayout.LEFT);
content.setLayout(lay);
setBackground(Color.blue);
couple.addActionListener(this);
one.addActionListener(this);
save.addActionListener(this);
tekst1Panel.add(tekst1);
tekst1Panel.add(intekst1);
tekst2Panel.add(tekst2);
tekst2Panel.add(intekst2);
content.setLayout(lay);
content.add(tekst1Panel);
content.add(tekst2Panel);
content.add(zgjedhjePanel);
content.add(ana);
content.add(rezervo);
setContentPane(content);
}
public void savecoupleroom()
{String[] coupleroom={"1","2","3","4","5","6","7","8","9","10"};
for(int i=0 ;i<=coupleroom.length;i++)
{if (i>coupleroom.length)
{String str="No more couple rooms";
ana.setText(str);}
else{ coupleroom[i]=coupleroom[i+1];
String str1="Couple room"+coupleroom[i]+"saved";
ana.setText(str1);}
}
}
public void saveoneroom()
{String[] oneroom={"1","2","3","4","5","6","7","8","9","10"};
for(int i=0 ;i<=oneroom.length;i++)
{if (i>oneroom.length)
{String str="No more rooms for one person";
ana.setText(str);}
else{ oneroom[i]=oneroom[i+1];
String str1="One person room"+oneroom[i]+"saved";
ana.setText(str1);}
}
}
public void actionPerformed(ActionEvent event)
{ if(event.getSource()==couple)
{savecoupleroom();}
if (event.getSource()==one)
{saveoneroom();}
}
public static void main(String[] args)
{HotelManagement manage= new HotelManagement();}
}