package ch07_auxiliaryclasses.taxcalculator;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class UPApp extends JFrame implements ActionListener {
  
     JButton displayadvice = new JButton("Displayadvice");
     JSpinner ucasPointSp = new JSpinner(new SpinnerNumberModel(0,0,180,10));
     JRadioButton Degree = new JRadioButton("Degree", true);
     JRadioButton FoundationDegree = new JRadioButton("Foundation Degree", false);
     ButtonGroup bg = new ButtonGroup();
     JButton doneBtn = new JButton("DisplayAdvice");
     JTextField commentTxt = new JTextField(11);
     JComboBox course = new JComboBox();
     
    public static void main(String[] args) {
        new UPApp();
    }

    public UPApp() {
        setLayout(new BorderLayout());
        setSize(500, 135);
        setTitle("University of peckham course chooser");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        
        JPanel top= new JPanel();
        top.setLayout(new FlowLayout());
        course.addItem("Software Engineering");
        course.addItem("Computer Science");
        course.addItem("Information System");
        course.addItem("Multimedia Studies");
        top.add(course);
        add("North", top);
        add("Center", commentTxt);
        add("South", doneBtn);
        doneBtn.addActionListener(this);
         
         JPanel northtop = new JPanel ();
         bg.add(Degree);
         bg.add(FoundationDegree);
        top.add(Degree);
        top.add(FoundationDegree);
        top.add(ucasPointSp);
            
        JPanel bottom = new JPanel ();
       
         setVisible(true);
       
        commentTxt.setEditable(false);
 
       
              
}
      public void actionPerformed(ActionEvent e) {
        String adv;   
if (course.getSelectedItem().equals("software engineering")) {
            adv= " Go to Room 100 ";
            
        } else if (course.getSelectedItem().equals("computer science")) {
            adv=" Go to Room 102";
            
        } else if (course.getSelectedItem().equals("information system")) {
        adv= " Go to Room 103 ";

} else if 
        (course.getSelectedItem().equals("multimedia studies")) {
            adv=" Go to Room 104 ";

        } else {
           
            adv= (" sorry this no course avaiable ");
}
          commentTxt.setText(" My advice is\n" + adv);
     }
}

• Software Engineering is offered at degree level only and requires a minimum of 180 points.
• Computer Science is offered at degree level (minimum 150 points) and foundation degree level (minimum 100 points).
• Information Systems is offered at degree level (minimum 120 points) and foundation level (minimum 80 points).
• Multimedia Studies is offered at foundation level only (minimum 120 points).
A Java GUI application is required to offer advice to prospective students on the selection of courses. The input information should be passed to an auxiliary class with a getAdvice() method which returns some advice to the applicant.
The advice to be offered is to proceed to room 101, 102, 103 or 104 for further details on Software Engineering, Computer Science, Information Systems or Multimedia courses respectively, or a suitable error message if the particular course/level combination chosen is not offered, or if the number of points is insufficient.
There should be a way of entering the course required, the level, and the number of points obtained, and a button which displays the advice when clicked.

Recommended Answers

All 2 Replies

by writing the code.
all I see is your assignment, what are you having trouble with exactly?

1: Use CODE tags to show code. This is unreadable.
2: We are not going to make your homework. Ask a question, and we can try to answer it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.