
Muhammad A.
asked 07/10/21Write java code and make same as GUI as Performa given description and save the input given by user (in form of string and radio button) in a excel file.
Proforma
Alumni Survey
(To be filled by Alumni - after the completion of each academic year)
The purpose of this survey is to obtain alumni input on the quality of education they received and the level of preparation they had at University. The purpose of this survey is to assess the quality of the academic program. We seek your help in completing this survey.
A: Excellent B: Very good C: Good D: Fair E: Poor
Knowledge
1. Math, Science, Humanities and professional discipline, (if applicable) (A) (B) (C) (D) (E)
2. Problem formulation and solving skills (A) (B) (C) (D) (E)
3. Collecting and analyzing appropriate data (A) (B) (C) (D) (E)
4. Ability to link theory to Practice (A) (B) (C) (D) (E)
5. Ability to design a system component or process (A) (B) (C) (D) (E)
6. Computer knowledge. (A) (B) (C) (D) (E)
II. Communication Skills
1. Oral communication (A) (B) (C) (D) (E)
2. Report writing (A) (B) (C) (D) (E)
3. Presentation skills (A) (B) (C) (D) (E)
III. Interpersonal Skills
1. Ability to work in teams. (A) (B) (C) (D) (E)
2. Ability to work in arduous /Challenging situation (A) (B) (C) (D) (E)
3. Independent thinking (A) (B) (C) (D) (E)
4. Appreciation of ethical Values (A) (B) (C) (D) (E)
IV. Management & Leadership Skills
1. Resource and time management skills (A) (B) (C) (D) (E)
2. Judgment (A) (B) (C) (D) (E)
3. Discipline (A) (B) (C) (D) (E)
V. General Comments
Please make any additional comments or suggestions, which you think would help strengthen our programs. (New courses that you would recommend and courses that you did not gain much from)
___________________________________________________________________
___________________________________________________________________
VI. Career Opportunities
___________________________________________________________________
VII. Department Status
1. Infrastructure (A) (B) (C) (D) (E)
2. Faculty (A) (B) (C) (D) (E)
3. Repute at National level (A) (B) (C) (D) (E)
4. Repute at international level (A) (B) (C) (D) (E)
VIII. Alumni Information
1. Name (Optional):
2. Name of organization:
3. Position in organization:
4. Year of graduation:
1 Expert Answer

Patrick B. answered 07/10/21
Math and computer tutor/teacher
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
public class MyPanel extends JPanel implements ActionListener
{
public static final int COLOR_NONE=0;
public static final int COLOR_RED=1;
public static final int COLOR_WHITE=2;
public static final int COLOR_BLACK=3;
public static final int SIZE_NONE=0;
public static final int SIZE_SMALL=1;
public static final int SIZE_MEDIUM=2;
public static final int SIZE_LARGE=3;
private JButton cmdButOK;
private JLabel labelColor;
private JRadioButton radioButtonRED;
private JRadioButton radioButtonWHITE;
private JRadioButton radioButtonBLACK;
private ButtonGroup buttonGroupColor;
private JLabel labelSize;
private JRadioButton radioButtonSMALL;
private JRadioButton radioButtonMEDIUM;
private JRadioButton radioButtonLARGE;
private ButtonGroup buttonGroupSize;
private JLabel labelEMAIL;
private JTextArea txtEMAIL;
protected int color;
protected int size;
protected String email;
public MyPanel()
{
//constructs components
cmdButOK = new JButton ("OK");
labelColor = new JLabel ("Select Color");
radioButtonRED = new JRadioButton ("RED");
radioButtonWHITE = new JRadioButton ("WHITE");
radioButtonBLACK = new JRadioButton ("BLACK");
buttonGroupColor = new ButtonGroup();
labelSize = new JLabel ("Select Size");
radioButtonSMALL = new JRadioButton ("SMALL");
radioButtonMEDIUM = new JRadioButton ("MEDIUM");
radioButtonLARGE = new JRadioButton ("LARGE");
buttonGroupSize = new ButtonGroup();
labelEMAIL = new JLabel ("EMAIL");
txtEMAIL = new JTextArea (1,255);
//adjusts size and set layout
setPreferredSize (new Dimension (636, 177));
setLayout (null);
//adds components
add (cmdButOK);
add (radioButtonRED);
add (radioButtonWHITE);
add (radioButtonBLACK);
add (radioButtonSMALL);
add (radioButtonMEDIUM);
add (radioButtonLARGE);
add (labelColor);
add (labelSize);
add (radioButtonWHITE);
add (labelEMAIL);
add (txtEMAIL);
buttonGroupColor.add(radioButtonRED);
buttonGroupColor.add(radioButtonWHITE);
buttonGroupColor.add(radioButtonBLACK);
radioButtonRED.addActionListener(this);
radioButtonWHITE.addActionListener(this);
radioButtonBLACK.addActionListener(this);
buttonGroupSize.add(radioButtonSMALL);
buttonGroupSize.add(radioButtonMEDIUM);
buttonGroupSize.add(radioButtonLARGE);
radioButtonSMALL.addActionListener(this);
radioButtonMEDIUM.addActionListener(this);
radioButtonLARGE.addActionListener(this);
//sets component bounds (only needed by Absolute Positioning)
cmdButOK.setBounds (235, 145, 100, 20);
radioButtonRED.setBounds (170, 25, 100, 25);
radioButtonBLACK.setBounds (375, 25, 100, 25);
radioButtonSMALL.setBounds (165, 65, 100, 25);
radioButtonMEDIUM.setBounds (265, 65, 100, 25);
radioButtonLARGE.setBounds (375, 60, 100, 25);
labelColor.setBounds (55, 25, 100, 25);
labelSize.setBounds (55, 70, 100, 25);
radioButtonWHITE.setBounds (270, 25, 100, 25);
labelEMAIL.setBounds (75, 115, 100, 25);
txtEMAIL.setBounds (155, 105, 405, 25);
color=COLOR_NONE;
size =SIZE_NONE;
email = new String(" ");
cmdButOK.addActionListener(
new ActionListener()
{
@Override public void actionPerformed(ActionEvent e)
{
email = txtEMAIL.getText();
if (color==COLOR_NONE) { JOptionPane.showMessageDialog(null,"Please select color"); }
else if (size==SIZE_NONE) { JOptionPane.showMessageDialog(null,"Please select size"); }
else if ((email.trim()).length()==0)
{
JOptionPane.showMessageDialog(null,"Please input email");
}
else
{
//records the data to csv file
Write();
System.exit(0);
}
}
} //new
); //addActionListener
}
@Override public void actionPerformed(ActionEvent e)
{
if (radioButtonRED.isSelected())
{
color=COLOR_RED;
}
else if (radioButtonWHITE.isSelected())
{
color=COLOR_WHITE;
}
else if (radioButtonBLACK.isSelected())
{
color=COLOR_BLACK;
}
if (radioButtonSMALL.isSelected())
{
size=SIZE_SMALL;
}
else if (radioButtonMEDIUM.isSelected())
{
size=SIZE_MEDIUM;
}
else if (radioButtonLARGE.isSelected())
{
size = SIZE_LARGE;
}
}
//saves the data to file "survey.csv" so that it can be opened in MS Excel
// format color,size,email
// EX. for large ,black 3,3,[email protected]
public void Write()
{
try
{
String outbuff = color + "," + size + "," + email;
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("E:\\survey.csv", true)));
out.println(outbuff);
out.close();
}
catch (Exception ex)
{
System.out.println("Exception error saving results ");
}
}
public static void main (String[] args)
{
JFrame frame = new JFrame ("MyPanel");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add (new MyPanel());
frame.pack();
frame.setVisible (true);
}
}
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Patrick B.
Use this as an example of how to group the option buttons07/10/21