Programming Assignment 01 Review Of Classes, Objects, Arrays, And Enhanced For Looping Solution
Given:
UML Class Diagram of Policy (on Blackboard)
Test harness shell: Test_Policy. java (on Blackboard)
These instructions
Sample output (on Blackboard)
Grading Rubric (on Blackboard)
Tasks:
Write the Java code to describe class Policy in accordance with the provided UML Class Diagram and the published Basic Coding Standards document
Complete the code for Test _ Policy. java such that it successfully serves to test the class Policy and meets the specific requirements listed below.
Requirements:
Policy. java
Code the Java class Policy according the LJMN Class Diagram provided and the instructions included here.
The class Policy will require two constructors: The default or null constructor will accept no parameters and will produce a Policy object having no established instance variable values. The full constructor will accept five (5) values: three (3) String values, an int, and a double. The full constructor will call the appropriate "set" methods to assign the received values to the appropriate instance variables. NOTE: Direct assignment of instance variable values effectively invalidates the full constructor. In such a case, the student will lose all points assigned for the full constructor. Write "set" methods for all instance variables. Flag all "set" methods as "final" methods. Each "set" method will accept the appropriate data type value and assign it to the appropriate instance variable. "Set" methods do not return values. "Set" methods must not contain any code other than that required to set a value for the given instance variable. Naming of "set" methods must be according to published standards.
"Get" methods will be written for all instance variables. "Get" methods are flagged as "final" methods. "Get" methods accept no parameters. Each "get" method must return a type appropriate to the instance variable with which it is associated. "Get" methods will not contain any code other than that required to set a value for the given instance variable. Naming of "get" methods must be according to published standards.
Method txtP01Type will return a String translation of the coded type instance value: If type 1: return "AIJTO" If type = 2: return "HOMEOWNERS" Method toString: Returns a reference to a formatted String obiect containing a description of the Policy object as shown in the Class Diagram
Must use "get" and other methods as appropriate to retrieve instance variable values. NOTE: Direct reference to instance variables in the toString method will invalidate
the method, resulting in zero points for that code.
Use the format method to format the returned String obiect correctly/appropriately. Do not include any unnecessary or unneeded code. Use Basic Coding Standards. This specifically applies to the commenting of code.
Test _ Policy. java
The assignment folder includes the basic code for testing your Policy class. Add code to complete the
following functions:
Each kinstantiated Policy object will be stored in an array. To accomplish this, you must declare a one-dimensional array structure to hold Policy objects.
Name the array grpP01icy. Declare the array to hold six (6) Policy objects. In the printToStrings method, complete the enhanced for loop statement. Use the name oneContract as the local reference to the current Policy object. Do not change the System. out . printf statement in any way. Do not add any unneeded code. Do add comments as appropriate. Follow Basic Coding Standards.
Testing Your Code
Be sure to test your code thoroughly. While a structure for the test harness has been provided and your
test harness will be validated, I will do additional testing as well. Your code must meet requirements in