CS 280 Spring 2009                           Assignment 2 –Simple GUI and Simple Calculations                               100 “Assignment” points

 

Assigned: 01/28/2009

Due: 02/05/2009 at the start of class

 

Pre-Lab (Do Before Lab):  Bring materials – a USB for a take home copy. Plan out your GUI, tasks, objects, and events needed for program.

 

Main Assignment:

Imagine that you are writing a very basic program to provide the beginnings of a team scoring method for the Google Games.  A team (and right now we are only handling one) gets five points for each win, two points for each tie, and -1 points for each loss. Your program will have 3 text fields – for number of wins, losses, and ties. It will have a button to calculate the total points – when that button is clicked, the team’s points will be calculated and displayed (in a jlabel). Also provide capabilities to “Clear” – clear the text fields, and to “Exit” – exit the application.

 

Background Knowledge:

 

User Interface:

·         You’re just a beginning at setting up GUIs in NetBeans. Don’t worry too much about making the interface nice.  

·         DO put your name on the GUI form either as a label or on the title bar

 

Miscellaneous Details:

o    Define the number of points for wins, losses, and ties as constants, so that if the rules change the program is easy to change. If we haven’t covered that in class yet, Java constants are defined like:

§  The use of ALLCAPS is a convention

 

Good Programming Practices:

·         MAKE SURE YOUR PROGRAM WORKS! (i.e. gets correct results).  It must provide all of the requested capabilities AND provide them in the expected way.  

·         Put YOUR NAME, e-mail address, and purpose of the program in comments at the beginning of the program (Netbeans should also automatically put in the date – which is also a very good practice). The purpose should be what the program is supposed to do, not the learning goals.

·         Name meaningfully all jbuttons, jtxtfields, jlabels, etc that will be referred to in code.

·         Indent to show any structure of the program (The IDE usually does this well if you don’t go back and change things – probably not much to worry about on this basic of a program)

·         You MUST include some comments that explain your program in order to get full credit; for this simple program put one comment for each button, and “group” code for the calculate button.

 

Red Tape to Aid Grading:

·         Please set the name of the project to something other than the default name (JavaApplication1, …). 

·         Add  your name in a jlabel on the GUI form  and/or in the title bar.

 

Hand in:

 

 

Do your own assignments !!!!  Work that is copied or done with somebody (when not assigned to a group) will be punished. If programs are copied, both students will receive a zero for the assignment. If significant sections of programs are copied, points will be taken off. Changing small aspects of a copied program does not make it not a copy. Asking another for help on a step or two in a many-step assignment is acceptable; looking at another person’s program is temptation for cheating; handing in a near duplicate program is cheating