CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades | Students

Lab #14 (Exercise 15-1)

Create a Swing version of the Invoice application

Due Date: Tuesday of Week 5
10 points

In this lab, you'll create a Swing version of the Invoice application. The application should have a user interface that looks something like this:

  1. Open the InvoiceApp.java file. This file contains a public InvoiceApp class with an empty main method.
  2. Add a class that defines the frame shown above. This frame should be centered on the screen, it should not be resizable, and closing it should end the application. This frame should be displayed when the application starts.

  3. Add a class that defines a panel with the controls shown above, using a FlowLayout manager to align the controls.Implement the ActionListener interface for this class so it will respond to the user selecting the Exit or Calculate button. If the user selects the Exit button, the application should end. If the user selects the Calculate button, the application should calculate and display the discount percent, discount amount, and invoice total. (The discount percent should be 20% if the subtotal is greater than or equal to $200, 10% if the subtotal is less than $200 but greater than or equal to $100, and 0% if the subtotal is less than $100). Create an instance of this class and add it to the frame from the frame class.

  4. Add the import statements needed by this application. Then, compile the application and run it to be sure it works correctly.
Include in your program the following comments:
  • Name of program
  • Team's name with all the names of the members (e.g. Team A: John Doe, Jane Smith, etc.)
  • Current Date
  • Computer system and compiler you are using
  • Brief description of the program

Compile and run the Java program.

Take a screen capture by hitting simultaneously the keys Alt and Print Screen (Prt Sc) of the output results (console) and paste it in MS Paint. Save it as a gif file.

When you are ready, upload the java program and the gif file by clicking the link below:

Upload Lab

I cannot grade if I don't get the files and receive your email.