Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Create a tester class called DogApplication in same package as you have create the Dog and DogLicense classes. In the DogApplication class , have

Question:

Create a tester class called DogApplication in same package as you have create the Dog and DogLicense classes. In the DogApplication class , have a main method in which you will test the Dog and Dog License objects one by one.

  1. Create another Dog object dog1 using the overloaded constructors. Provide arguments of your choice, but make sure they are in the same order as you have specified in the constructors

  2. Using getters, obtain dog1s name, weight and years and print out the details of dog1 on the output. Please make sure to include comments.

  3. Create a DogLicense object called dog1License using the default constructor of DogLicense class.

  4. Using the getter , obtain dog1s name and pass on this value ( the variable ) to set the name of dog1License object. To do this you will need use the getter to get dog1s name and save the return in a name variable. Then pass on this name variable to the setter of dog1Lcenses setName setter method.

  5. Using the getter , obtain dog1s years. Subtract that value of dog1s years from 2018 and use the result to set the variable called licenseYear. For example if dogs years is 5, then license year is 2018-5 = 2013. Call the setter, (pass on the value of licenseYear ) for dog1License to set the value of its licenseYear instance variable.

  6. Prompt the user to enter a 4 digit number and store this value in a variable called customID.

  7. Call the method called createLicenseNum for dog1Liscense and pass on this method, the value of customID.

  8. Using getters obtain the values of all instance variables of dog1License and print them on the output with comments.

Previous Dog and DogLicense classes:

Create a tester class called DogApplication in same package as you have create the Dog and DogLicense classes. In the DogApplication class , have a main method in which you will test the Dog and Dog License objects one by one.

  1. Create another Dog object dog1 using the overloaded constructors. Provide arguments of your choice, but make sure they are in the same order as you have specified in the constructors

  2. Using getters, obtain dog1s name, weight and years and print out the details of dog1 on the output. Please make sure to include comments.

  3. Create a DogLicense object called dog1License using the default constructor of DogLicense class.

  4. Using the getter , obtain dog1s name and pass on this value ( the variable ) to set the name of dog1License object. To do this you will need use the getter to get dog1s name and save the return in a name variable. Then pass on this name variable to the setter of dog1Lcenses setName setter method.

  5. Using the getter , obtain dog1s years. Subtract that value of dog1s years from 2018 and use the result to set the variable called licenseYear. For example if dogs years is 5, then license year is 2018-5 = 2013. Call the setter, (pass on the value of licenseYear ) for dog1License to set the value of its licenseYear instance variable.

  6. Prompt the user to enter a 4 digit number and store this value in a variable called customID.

  7. Call the method called createLicenseNum for dog1Liscense and pass on this method, the value of customID.

  8. Using getters obtain the values of all instance variables of dog1License and print them on the output with comments.

  9. The previous problem, we modeled a Dog class for a dog tracking application. In this problem we will model a Dog license for the same application. The Dog license object captures data on the dogs license number, license year, licensing authority etc. We are now planning to create and store dog licenses using a new application. To do this we need to create the required classes and their functions

This dog application will capture these properties in a separate class called DogLicense. Create a class called DogLicense with the following instance variables: licenseNum, licenseYear and name of the type int, int and String, respectively.

The DogLicense class is supposed to keep the instance variables private.

However, these instance variables are to be accessed by the client application. Therefore, the class requires getters and setters for each instance variable, except for setting the licenseNum. The licenseNum is set only once during the lifetime of the DogLicense object using the createLicenseNum method as described below.

Some dogs may not have a license number initially and they may need to be generated later on. To do this, the DogLicense class will have a method called createLicenseNum. This method will take in an integer argument called customID . This method has a void return. This method will assign a value to the instance variable licenseNum = (500*customID)+licenseYear . The DogLicense class requires a default constructor. Use default values of your choice for the instance variables.

The DogLicense class requires an overloaded constructor with all three 3-arguments.

I was able to code Dog and DogLicense class but I need help on DogApplication.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

What advantages do taller people have over shorter people?

Answered: 1 week ago