In this lab you will create one project that uses inheritance and two simple Graphical User Interface (GUI) programs.
Deliverables
Program files for each of the following three programs
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.
Example:
/***********************************************************************
Program Name: ProgramName.java
Programmer’s Name: Student Name
Program Description: Describe here what this program will do
***********************************************************************/
How to submit your assignment:
iLAB STEPS
STEP 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 methods for each class. The private variable of Point should be the x-y coordinates. The private data of Square should be the sideLength. The private data of Cube should be depth. Each class must provide applicable accessor, 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 provide the area() and volume() methods.
Write a program that instantiates objects of your classes, ask the user to enter the value for x, y, and sideLength, test all instance methods and outputs of each object’s perimeter, area, and volume when appropriate.
Grading Rubric
InheritanceTest |
Points |
Description |
Standard header included |
1 |
Must contain program’s name, student name, and description of the program |
Program compiles |
1 |
Program does not have any error |
Program executes |
1 |
Program runs without any error |
Point class created |
3 |
Class contains accessor, mutator, and toString methods |
Square class created |
3 |
Class contains accessor, mutator, toString, perimeter, and area methods |
Cube class created |
3 |
Class contains accessor, mutator, toString, area, and volume methods |
InheritanceTest class created |
4 |
Test class asks user for input of x, y, and sideLength and tests all instance methods |
Correct output is displayed |
4 |
Test class produces correct output showing all values corresponding to each object |
Subtotal |
20 |
|
STEP 2: DayGui (10 points)
Write a program called DayGui.java that creates a GUI having the following properties
Object |
Property |
Setting |
JFrame |
Name |
mainFrame |
JButton |
Name |
cmdGood |
JButton |
Name |
cmdBad |
Add 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 theBad button is clicked, the message “I’m having a bad day today!” is displayed. The following tutorial shows you much of the code solution. Feel free to use the tutorial, but make changes so that you are not simply copying the tutorial code for your entire 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:
Grading Rubric
DayGui |
Points |
Description |
Standard header included |
1 |
Must contain program’s name, student name, and description of the program |
Program compiles |
1 |
Program does not have any error |
Program executes |
1 |
Program runs without any error |
DayGui class created |
1 |
Class DayGui was created which contains the required properties |
cmdGood JButton created along with the event handler |
1.5 |
The Good button shows on the application and when pressed the appropriate message displays on a separate window |
cmdBad JButton created along with the event handler |
1.5 |
The Bad button shows on the application and when pressed the appropriate message displays on a separate window |
Application contains required changes and displays the correct output |
3 |
Application appears as one of the tabs in a tabbed application and buttons and panel are in different colors |
Subtotal |
10 |
|
STEP 3: OfficeAreaCalculator (10 points)
Write a program called OfficeAreaCalculator.java that displays the following prompts using two label components
Have your program accept the user input in two text fields. When a button is clicked, your program should calculate the area of the office and display the area in a text field with a label of Area. This display should be cleared whenever the input text fields receive the focus. A second button should be provided to terminate the application (Exit button).
The following tutorial shows you much of the code solution. Feel free to use the tutorial, but make changes so that you are not simply copying the tutorial code for your entire solution. To make this different from the tutorial, change the colors of the panel. Also, add this application to the same tabbed pane (see the JTabbedPanetutorial) as the application you built in Step 2, the DayGui application.
Grading Rubric
OfficeAreaCalculator |
Points |
Description |
Standard header included |
1 |
Must contain program’s name, student name, and description of the program |
Program compiles |
1 |
Program does not have any error |
Program executes |
1 |
Program runs without any error |
Created Length label and Length input textbox field |
1 |
The Length label and input textbox show on the application and users can enter valid numeric value in the textbox |
Created Width label and Width input textbox field |
1 |
The Width label and input textbox show on the application and users can enter valid numeric value in the textbox |
Created Area label and Area input textbox field |
1 |
The Area label and input textbox show on the application and the area value displays in the textbox when the Calculate button is pressed |
Created Calculate button with the appropriate handler |
1 |
The Calculate button calculates the area given the length and width of the office |
Created Exit button with the appropriate handler |
1 |
The Exit button exits the application and terminates the program |
Application contains required changes and displays the correct output |
2 |
Application appears as one of the tabs in a tabbed application and panel is in a different color |
Subtotal |
10 |
|
Why Choose Us
Quality Papers
We value our clients. For this reason, we ensure that each paper is written carefully as per the instructions provided by the client. Our editing team also checks all the papers to ensure that they have been completed as per the expectations.
Professional Academic Writers
Over the years, our Acme Homework has managed to secure the most qualified, reliable and experienced team of writers. The company has also ensured continued training and development of the team members to ensure that it keep up with the rising Academic Trends.
Affordable Prices
Our prices are fairly priced in such a way that ensures affordability. Additionally, you can get a free price quotation by clicking on the "Place Order" button.
On-Time delivery
We pay strict attention on deadlines. For this reason, we ensure that all papers are submitted earlier, even before the deadline indicated by the customer. For this reason, the client can go through the work and review everything.
100% Originality
At Essay USA, all papers are plagiarism-free as they are written from scratch. We have taken strict measures to ensure that there is no similarity on all papers and that citations are included as per the standards set.
Customer Support 24/7
Our support team is readily available to provide any guidance/help on our platform at any time of the day/night. Feel free to contact us via the Chat window or support email: support@acmehomework.com.
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
Our Services
Essay USA has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.
Essays
At Essay USA, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.
Admissions
Admission and Business Papers
Be assured that you’ll definitely get accepted to the Master’s level program at any university once you enter all the details in the order form. We won’t leave you here; we will also help you secure a good position in your aspired workplace by creating an outstanding resume or portfolio once you place an order.
Editing
Editing and Proofreading
Our skilled editing and writing team will help you restructure you paper, paraphrase, correct grammar and replace plagiarized sections on your paper just on time. The service is geared toward eliminating any mistakes and rather enhancing better quality.
Coursework
Technical papers
We have writers in almost all fields including the most technical fields. You don’t have to worry about the complexity of your paper. Simply enter as much details as possible in the place order section.