Programming Assignment 01 Review of Classes, Objects, Arrays, and Enhanced for Looping Solved

30.00 $

Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment


5/5 - (2 votes)


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)


  1. Write the Java code to describe class Policy in accordance with the provided UML Class

Diagram and the published Basic Coding Standards document

  1. Complete the code for Test _ Policy. java such that it successfully serves to test the class

Policy and meets the specific requirements listed below.


Policy. java

  1. Code the Java class Policy according the LJMN Class Diagram provided and the instructions

included here.

  1. The class Policy will require two constructors:
  2. The default or null constructor will accept no parameters and will produce a Policy object having no established instance variable values.
  3. The full constructor will accept five (5) values: three (3) String values, an int, and a double.
  4. 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.
  5. Write “set” methods for all instance variables.
  6. Flag all “set” methods as “final” methods.
  7. Each “set” method will accept the appropriate data type value and assign it to the appropriate instance variable.
  8. “Set” methods do not return values.
  9. “Set” methods must not contain any code other than that required to set a value for the given instance variable.
  10. Naming of “set” methods must be according to published standards.


  1. “Get” methods will be written for all instance variables.
  2. “Get” methods are flagged as “final” methods.
  3. “Get” methods accept no parameters.
  4. Each “get” method must return a type appropriate to the instance variable with which it is associated.
  5. “Get” methods will not contain any code other than that required to set a value for the given instance variable.
  6. Naming of “get” methods must be according to published standards.


  1. Method txtP01Type will return a String translation of the coded type instance value:
  2. If type 1: return “AIJTO”
  3. If type = 2: return “HOMEOWNERS”
  4. Method toString:
  5. Returns a reference to a formatted String obiect containing a description of the

Policy object as shown in the Class Diagram

  1. 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.

  1. Use the format method to format the returned String obiect correctly/appropriately.
  2. Do not include any unnecessary or unneeded code.
  3. 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:

  1. 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.

  1. Name the array grpP01icy.
  2. Declare the array to hold six (6) Policy objects.
  3. In the printToStrings method, complete the enhanced for loop statement.
  4. Use the name oneContract as the local reference to the current Policy object.
  5. Do not change the System. out . printf statement in any way.
  6. Do not add any unneeded code.
  7. Do add comments as appropriate.
  8. 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

those additional test cases.