Your SlideShare is downloading. ×
CIS/355 ilab 4 of 6
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

CIS/355 ilab 4 of 6

55
views

Published on

Program files for each of the following three programs …

Program files for each of the following three programs
1. InheritanceTest
2. DayGui
3. OfficeAreaCalculator
At the beginning of ALL your programs, put a comment box that includes the program name, your name, and a brief description of the program.

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
55
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CIS/355 iLab 4 of 6iLab 4 of 6: Inheritance and Simple GUI iLAB OVERVIEWScenario and SummaryIn this lab you will create one project that uses inheritance and two simple Graphical User Interface (GUI)programs.DeliverablesProgram files for each of the following three programs1. InheritanceTest2. DayGui3. OfficeAreaCalculatorAt the beginning of ALL your programs, put a comment box that includes the program name, yourname, and a brief description of the program.Example:/***********************************************************************Program Name: ProgramName.javaProgrammers Name: Student NameProgram Description: Describe here what this program will do***********************************************************************/How to submit your assignment:1. The programs MUST have the same names as the assignment title.2. Each Java source file (*.java) must include a corresponding class file (*.class) program as evidenceof success.3. In addition to the program source code files and byte code files, put all your program source codefiles and screen shots of your program output files into a Word document.4. You must use a zipped folder to send your weekly assignment to the Dropbox. Do not sendsubfolders within your zipped folder. Place ALL of the .java and .class files for the week into the onezipped folder. The zip folder should be named: CIS355A_YourLastName_iLab_Week4, and this zip folderwill contain all the weekly programming assignments.
  • 2. iLAB STEPSSTEP 1: InheritanceTest (20 points)Write a program called InheritanceTest.java to support an inheritance hierarchy for class Point-Square-Cube. Use Point as the superclass of the hierarchy. Specify the instance variables and methodsfor each class. The private variable of Point should be the x-y coordinates. The private data of Squareshould be the sideLength. The private data of Cube should be depth. Each class must provide applicableaccessor, mutator, and toString() methods for manipulating private variables of each corresponding class.In addition, the Square class must provide the area() and perimeter() methods. The Cube must providethe area() and volume() methods.Write a program that instantiates objects of your classes, ask the user to enter the value for x, y, andsideLength, test all instance methods and outputs of each object’s perimeter, area, and volume whenappropriate.Grading Rubric InheritanceTest Points DescriptionStandard header included 1 Must contain programs name, student name, and description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any errorPoint class created 3 Class contains accessor, mutator, and toString methodsSquare class created 3 Class contains accessor, mutator, toString, perimeter, and area methodsCube class created 3 Class contains accessor, mutator, toString, area, and volume methodsInheritanceTest class 4 Test class asks user for input of x, y, and sideLength and tests allcreated instance methodsCorrect output is 4 Test class produces correct output showing all valuesdisplayed corresponding to each object Subtotal 20STEP 2: DayGui (10 points)Write a program called DayGui.java that creates a GUI having the following properties Object Property Setting
  • 3. Name mainFrame JFrame Caption Messages Layout FlowLayout Name cmdGood JButton Caption Good Mnemonic G Name cmdBad JButton Caption Bad Mnemonic BAdd individual event handlers to your program so that when a user clicks the Good button, the message"Today is a good day!" appears in a dialog box, and when the Bad button is clicked, the message "Imhaving a bad day today!" is displayed. The following tutorial shows you much of the code solution. Feelfree to use the tutorial, but make changes so that you are not simply copying the tutorial code for yourentire solution. To make this different from the tutorial, change the colors of the buttons and panel. Also,add this application to a tabbed pane along with the program you will complete in the next step, Step 3.The following tutorials will likely be useful as you work to complete this step: JTabbedPane Tutorial to Write Your First GUIGrading Rubric DayGui Points DescriptionStandard header included 1 Must contain program’s name, student name, and description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any errorDayGui class created 1 Class DayGui was created which contains the required propertiescmdGoodJButton created along with 1.5 The Good button shows on the application and whenthe event handler pressed the appropriate message displays on a separate windowcmdBadJButton created along with 1.5 The Bad button shows on the application and whenthe event handler pressed the appropriate message displays on a separate windowApplication contains required 3 Application appears as one of the tabs in a tabbedchanges and displays the correct application and buttons and panel are in differentoutput colors Subtotal 10
  • 4. STEP 3: OfficeAreaCalculator (10 points)Write a program called OfficeAreaCalculator.java that displays the following prompts using two labelcomponents Enter the length of the office: Enter the width of the office:Have your program accept the user input in two text fields. When a button is clicked, your programshould calculate the area of the office and display the area in a text field with a label of Area. This displayshould be cleared whenever the input text fields receive the focus. A second button should be provided toterminate the application (Exit button).The following tutorial shows you much of the code solution. Feel free to use the tutorial, but makechanges so that you are not simply copying the tutorial code for your entire solution. To make thisdifferent from the tutorial, change the colors of the panel. Also, add this application to the same tabbedpane (see the JTabbedPane tutorial) as the application you built in Step 2, the DayGui application. Office Area Calculator TutorialGrading Rubric OfficeAreaCalculator Points DescriptionStandard header included 1 Must contain program’s name, student name, and description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any errorCreated Length label and Length 1 The Length label and input textbox show on theinput textbox field application and users can enter valid numeric value in the textboxCreated Width label and Width input 1 The Width label and input textbox show on thetextbox field application and users can enter valid numeric value in the textboxCreated Area label and Area input 1 The Area label and input textbox show on thetextbox field application and the area value displays in the textbox when the Calculate button is pressedCreated Calculate button with the 1 The Calculate button calculates the area given theappropriate handler length and width of the officeCreated Exit button with the 1 The Exit button exits the application and terminatesappropriate handler the programApplication contains required 2 Application appears as one of the tabs in a tabbedchanges and displays the correct application and panel is in a different coloroutput
  • 5. Subtotal 10CLICK HERE TO GET THE SOLUTION !!!!!!!!!