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");
        JPanel top= new JPanel();
        top.setLayout(new FlowLayout());
        course.addItem("Software Engineering");
        course.addItem("Computer Science");
        course.addItem("Information System");
        course.addItem("Multimedia Studies");
        add("North", top);
        add("Center", commentTxt);
        add("South", doneBtn);
         JPanel northtop = new JPanel ();
        JPanel bottom = new JPanel ();
      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.

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

5 Years
Discussion Span
Last Post by hiddepolen

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.