(50 PTS) 1. You need to create a class along with a test GUI that will
allow a user to convert kilometers to miles,
yards, feet and inches.
- you need just one text field for input
- you need one command button which the user will
press because we will assume their input is in kilometers
- you want to convert the distance so that it
- miles (integer)
- yards (integer)
- feet (integer)
- inches (float)
- so you will need four text fields for output
You can choose to approach this problem in one of two
- For example, you want to make certain your code
converts something like 10 kilometers into as many miles as it contains
first ... likely to be 6 miles ... then converts the remainder to yards
... the remainder to feet ... then the remainder to inches. You
want to make certain the number of miles, yards and feet are all
- You can convert the kilometers to
so that you are not looking at the remainders and
working with all doubles.
You also need to have helpful error
trapping and input validation.
Working with Complex Numbers
(50 PTS Total) (Problem 8.2 P440) 2. Create a class called
for performing arithmetic with complex number. You will also need to
write a driver program to test your class along with a GUI.
Use the instance variable and
method names that are provided within this problem statement.
- Use integer variables to represent the private
instance variables of the class - the
- Assume the realPart and imaginaryPart can be real
- Provide a constructor method that enables an
object of this class to be initialized when it is
- Make sure there is a no-argument constructor with
default values in case no initializers are provided.
Provide public methods for each of the following.
- Addition of two Complex
- Subtraction of two
- Multiplication of two
- Develop a toString( ) method for
numbers in the form a + bi , where
a is the
and b is the
You also need to provide for input validation
and appropriate error messages.