Solved–Lab #5 –Solution

$30.00 $19.00

This lab consists of a short exercise with GUI. JUnit tester Using the examples from the Canvas slides on testing, and the Square class from Lab 3, create a JUnit tester class SquareTester for the functionality of Square class. The SquareTester should inherit from TestCase, should override setUp() and tearDown() methods, and should test all…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

This lab consists of a short exercise with GUI.

JUnit tester

Using the examples from the Canvas slides on testing, and the Square class from Lab 3, create a JUnit tester class SquareTester for the functionality of Square class. The SquareTester should inherit from TestCase, should override setUp() and tearDown() methods, and should test all public methods of Square with several inputs (except for the methods that are not a constructor and don’t return anything).

ID Card

Using code from Zybook as an example, design an ID card with your picture (or any

picture you get o the web or draw in Paint) in the center, your name on the top, and

your personal information (height, weight, eye color, address) split left and right. The

bottom section of the card should display Java Programmer. The ID card should be

the size of a typical drivers license (5:3 width to height ratio), place it in the center of

the screen and do not allow resizing.

Hints:

Make a class IDCardFrame that extends JFrame.

The one-argument constructor should accept a title (String).

Create a JLabel with a picture and place it in the center of the frame using the GridBagLayout manager.

Create a Jlabel with your name and place it in the NORTH section using the GridBagLayout.

Create a JLabel that says “Java Programmer” and put it in the south region. The text of this JLabel should stand out among other text on the ID card, it’s up to you how you will implement it (bold font, color, frame, or anything else).

Make three JLabels, one with the height, one with weight, one with eye color. Data doesn’t have to be real, e.g. if you always dreamt of having orange eyes, feel free to put that on your card.

Add the labels to the GridBagLayout in appropriate places. Set the position and size of the frame.

Set resizable to false.

Make the frame visible.

Include main() that just instantiates IDCard.

(Extra credit): Add other Swing components, use color and background image, or use any other creative approach to make your ID card fancy. You can even think of imitating Facebook pro le or other type of pro le.

Submission

Check that your code is documented well. Submit both your SquareTester.java, IDCardFrame.java, and separately, submit the .jar le with your project (search the web for how to make .jar in IntelliJ). This way you will create a standalone executable Java application that anyone can run and use to learn the basics about you.