Menu

[solved]-Tasks 1 Create Policy Exception Des Socording Uml Class Diagram Two Constructors Anul Cons Q39085284

Tasks: 1. Create the Policy Exception des socording to its UML Class Diagram. There will be two constructors There will not bAttributes private owner: String Policy (abstract) implements BookValue Notes This instance variable will now carry a customeAttributes private EXPOSURE_RATE: double private propAddress: String private propType: int Home Owners subclass of Policy NotPolicyException subclass of some exception type Notes Attributes Operations |public PolicyException(String message ): PolicyE

Tasks: 1. Create the Policy Exception des socording to its UML Class Diagram. There will be two constructors There will not be anul constructor. 2. Modify Policy. Auta, and Home Owners classes from PAO2 so that they meet the revised requirements as shown in the UML class diagrams Add the required validation code os explained in the UMI diagrams. NOTE: for some volldations, aspectic method of validating Input is required. b. Throw a PolicyException when an object cannot be successfully instanticited. 6 Catch exceptions triggered by validation failures in set methods, then chain the exception Include all the values submitted to the constructor for instantiation of the object in the new, chained exception object. Instantiate the new, chained exception object as a Policy Exception type. d. Modify the tostring of both Auto ond HoneOwners classes to 1. Use the superclass toString method to provide bask policy Information il. Use a StringBuilder object to build the output. Requirements: Policy 1. Revise Policy ecording to the UML Class Diagram provided and these instructions 2. Validated owner new customer identifier for length of String and the integer value the String represents. Do not complete instantiation of the Policy object if the validation fails 3. Do not complete instantiation of the Policy objectif either owner of insured nomenul or all spaces 4. The policy number must have a specific structure: The first two characters must be alphabetic na numbers, special characters, or space The remaining portion of the policy number must consist of exactly 5 digits The validation must be done wig regular expression 5. Ha validation fails, throw a PolicyException. The message used to instantiate the exception objects include all values offered to the constructor. Auto 1. Modify the subclass Auto according to the UML requirements and the instructions provided here. 2. The model year be greater than 1999 and less than or equal to 2021. 3. The VIN must met specific requirements Q. It must be 17 characters long. Validate this using a String method. b. It may not contain special characters or white space. Volidate for this with a regular expression c t cannot contain the letter 1, 0or Q. Validate for this with a regular expression d. It must be al capital letter. Validate for this with a regular expression. NOTE: htems b through d may be done using a single regular expression. 4. Deductible value must be one of the following: 250, 500, 750, or 1000. No other values are Doceptable 5. Ha validation foil, throw a PolicyException. The message used to instantiate the exception objects include all values offered to the constructor 6. The tostring method wil be updated to meet the following requirements: G. For the fire portion of the output, call the supercles toString method. b. Use a StringBuilder object to build the output HomeOwners 1. Modify the subclows Homeowners according to the UML requirements and instructions as provided. 2. Property type must be digit between 1 and 5, Inclusive. If the offered value is out of range, assign the default value of 1 to the instance variable. Continue with instantiation of the object. 3. The insured value of the contents must be greater than and less than or equal to 1,000,000. Do not complete setition of the Homeowners object if the validation fails 4 The deductible must be between 1% and 10%, inclusive. Do not complete instantiation of the Homeowners object the validation fails 5. Ha validation fails, throw a PolicyException. The message used to instantiate the exception object must include of values offered to the constructor 6. The toString method will be updated to meet the following requirements: c. For the first portion of the output, call the superclass toString method. b. Use a StringBuilder object to build the output PolicyException Wrthe code for the subclass PolicyException according to the UML requirements as provided. Customer 1. Produce the clous Customer os described in the UML Class Diagram 2 Voldated customer Id for length of String di and the Integer value the String represent. Do not complete instantiation of the Customer object of the validation Polls 3. Volidote last name to ensure existence that is, the String may not be null or blank. Do not complete instantiation of the Customer object of the validation for 4. Volidate first name to ensure existe e that is the string may not be null or blank. Do not complete inventation of the Customer object of the validation for 5. Volidate the tox identifier for length and type of characters 19 digits. Do not complete instantiation of the Customer object if the validation foils. 6. We validation for throw a CustomerException. The message used to indicate the exception object mul include all values offered to the constructor CustomerException W e code for the subclass CustonerException according to the UML requirements as provided. Notes on Exceptions Exceptions thrown in the das code Policy, Auto, HomeOwners, Customer should be chained and passed up the call stock to the rest homes. Complete and meaningful messages should be provided for any/every error. Except for the requirement to indude all valves offered at the constructor level, the form and wording of exception messages is up to the team. Provided Code TestExceptionHandling.java The provided test homes contains only two les coses. Both are positive” test cases that is all the dete contained in each test come will/should pass validations. These DO NOT CONSTITUTE A COMPLETE TEST of your date validation of exception handlin. You will wo to add test comes to fully exercise oil the logk involved in your data validations and your exception handling logic. You can do this by adding test Attributes private owner: String Policy (abstract) implements BookValue Notes This instance variable will now carry a customer identifier for the owner value. The identifier must consist of 7 digits (digits only) and the numberic value represented by the String object must be greater than 10000. If the offered value does not meet these requirements, throw a PolicyException and do not create the Policy object. Full, legal name of named insured on policy. This may not be a null String or all spaces, if the offered value is null or all spaces, throw a PolicyException and do not create the Policy object. private insured: String private polNbr: String Unique identifier for specific policy. This policy number must meet these requirements: * The first two (2) characters must be alphabetic * These will be followed by exactly 5 digits [if the offered value does not meet the requirements, throw a PolicyException and do not create the Policy object. Use a regular expression to validate the offered value. Annual premium amount for policy private polPrem: double Operations public Policy(): Policy |public Policy(String own, String insa, String nbr, double prem): Policy Description Null constructor, establishes no instance variable values Constructor accepts four (4) parameter values, calls set methods and establishes instance variable values as appropriate. public identifyContract(): String Returns polNbr public toString(): String Returns a String reference to a formatted description of the Policy object: owner owns Policy polNbr insuring insured, with a premium of polPrem. NOTES: Set & get methods are not listed here, but are assumed to be present. Further, standard naming is assumed. Attributes private EXPOSURE_RATE: double private makeModel: String private model Year: int private vin: String Auto subclass of Policy Notes Current exposure rate for Auto policies is 0.0051 or 0.51%). This is a constant value set directly in the set method. No data will be passed into the constructor for this value. This is a CONSTANT value inot an instance value set at the class level. There is no need for either set or get methods for this value Make and model of autole. Ford Fusion) Model year of auto lie, 2016). The offered value must be greater than 1999 and less than or equal to 2021. If the offered value does not meet the rquirements, throw a Policy Exception and do not create the Auto object. Vehicle identification Number – unique vehicle identifier. Must meet the following requirements: 1) 17 characters long 2) May not contain special characters or white space 3) May not contain the letters LO, O Q 4) Ony capital letters are allowed If the offered value does not meet the requirements, throw a PolicyException & do not create the Auto object. Use a String method for requirement and a regular expression for requirements 2, 3, 4 An array of integer values representing coerage limits Collision Comprehensive UIM Stated in thousands of dollars Policy deductible, stated in dollars. Acceptable values are $250, S500, $750, or $1.000. If the offered vaue does not meet the requirements, throw a PolicyException and do not create the Auto object private limits: int[3] private deduct: int Description Null constructor establishes no instance variable values Constructor accepts values (one being a three-item array of integers Operations public Auto Auto public Autol String own, String ind, String nr. double prem, String model, int year, Stringid, intim int ded Auto public producelimitsTxt): String Returns a String describing the policy deductales: Collision limits[0]. Comprehensive: limits(1), UIM: limits (2) NOTE: Amounts should be formatted as Snnnnnn public calcExposure(): double Returns a double value representing the total possible exposure if the contract becomes immediately wholly payable For Auto policies, this is calculated as the total of all limits Returns a double value representing the current total book value of the contract. For Auto policies, this calculated as premium-(calcExposure exposureRate) public calcCurrentValue(): double public tostring String Returns a String reference to a formatted description of the Auto object: owner owns Policy potr insuring insured, with a premium of polprem. This Auto policy insures a model Year makeModel, VIN Vin, with limits producel titsTxt and a $deduct. Use a StringBuilder object. Use the superclass toString method for the first part of the output. 1. Set & get methods are not listed here, but are asumed to be present. Further, standard naming is assume 2. The first portion of the toString return will come from the superclass method 3. Direct access to instance values outside set/get methods) is, as always, forbidden *VIN validation is any required to meet the stated rules. Checksum, manufacturer formatting, etc, do not need to be validated Attributes private EXPOSURE_RATE: double private propAddress: String private propType: int Home Owners subclass of Policy Notes Current exposure rate for Homeowners policies is 0.0025 (or 0.25%). This is a constant value set directly in the set method. No data will be passed into the constructor for this value. This is a CONSTANT value (not an instance value); set at the class level. There is no need for either set or get methods for this value. Legal address of insured property Numeric code describing property type. Valid values are: 1 – single family dwelling 2-townhouse, attached 3-townhouse, detached 4- condominium 5-other eligible If the offered value is not within range, default to a value of 1. Structural coverage limit, stated in thousands of dollars. Acceptable values are greater than 0 and less than or equal to 10,000,000 If the offered value is not within range, throw a PolicyException & do not create the Homeowners object. Contents limits, stated in thousands of dollars. Acceptable values are greater than 0 and less than or equal to 1,000,000. If the offered value is not within range, throw a PolicyException and do not create the Homeowners object. Policy deductible as a percentage of total insured value (structure + contents). Acceptable values are greater than or equal to 0.01 and less than or equal to 0.10. of the offered value is not within range, throw a PolicyException and do not create the Homeowners obiect. Boolean indicating if policy is tied to umbrella coverage private structure: int private contents: int private deduct: double private umbrella: boolean Description Null constructor; establishes no instance variable values Constructor accepts values and returns a reference to a Homeowners object. Operations public Homeowners : Home Owners public Homeowners String own, String ind, String nbr, double prem, String addr, int type, int struct, int goods, double ded, boolean umbr : Homeowners public getDeductInDollars(): double Returns the dollar value of the deductible as: (structure contents) deductible public calcExposure(): double Returns a double value representing the total possible exposure if the contract becomes immediately, wholly payable. For Homeowners policies, this is calculated as the sum of structure and contents Returns a double value representing the current total book value of the contract. For Home Owners policies, this calculated as: premium calcExposure exposureRate) public calcCurrentValue): double public tostringString Returns a String reference to a formatted description of the Homeowners object: Owner owns Policy polNbr insuring insured, with a premium of polPren. This Home Owners policy insures a type propType home at propAddress. The structure is insured for $structure; contents for $contents. The deductible is $getDedcut InDoLLars. This policy is/is not part of an Umbrella contract. Use a StringBuilder object. Use the superclass toString method for the first part of the output. 1. Set & get methods are not listed here, but are assumed to be present. Further, standard naming is assume 2. The first portion of the toString return will come from the superclass method 3. Direct access to instance values (outside set/get methods) is, as always, forbidden PolicyException subclass of some exception type Notes Attributes Operations |public PolicyException(String message ): PolicyException public PolicyException( String message, Throwable cause ): PolicyException Description One-parameter contructor; passes parameter to appropriate superclass constructor. TWO-parameter constructor; passes parameters to appropriate superclass constructor. Customer Notes Attributes private custId: String A unique identifer for the customer. This String object must consist of 7 digits; the integer value represented by the String must be greater than 10000. If the offered value does not meet these requirements, throw a CustomerException and do not create the Customer object. private lastName: String private firstName: String Legal last name or Surname) of the customer. This may not be a null String or all spaces; if the offered value is null or all spaces, throw a CustomerException and do not create the Customer object. Legal first (or given) name of the customer. This may not be a null String or all spaces, if the offered value is null or all spaces, throw a Customer Exception and do not create the Customer object. Unique IRS-issued tax identifier for customer. Must be exactly 9 digits long. if the offered value does not meet the requirements, throw a CustomerException and do not create the Customer object. Use a regular expression to validate the offered value. private taxId: String Operations public Customer(): Customer Description Accepts no arguments. Creates a Customer object with default values: custId = “9999999” lastName = “INVALID” firstName = “INVALID” taxId = “999999999” Constructor accepts four (4) parameter values, calls set methods and establishes instance variable values as appropriate. public Customer(String id, String last, String first, String tax): Customer public toString():String Returns a String reference to a formatted description of the Customer object: Customer Id custId belongs to firstName Last Name, tax reporting id: taxid. NOTES: Set & get methods are not listed here, but are assumed to be present. Further, standard naming is assumed. CustomerException subclass of some exception type Notes Attributes Operations public Customer Exception String message ): CustomerException public CustomerException( String message, Throwable cause ): CustomerException Description One-parameter contructor; passes parameter to appropriate superclass constructor. TWO-parameter constructor; passes parameters to appropriate superclass constructor. Show transcribed image text Tasks: 1. Create the Policy Exception des socording to its UML Class Diagram. There will be two constructors There will not be anul constructor. 2. Modify Policy. Auta, and Home Owners classes from PAO2 so that they meet the revised requirements as shown in the UML class diagrams Add the required validation code os explained in the UMI diagrams. NOTE: for some volldations, aspectic method of validating Input is required. b. Throw a PolicyException when an object cannot be successfully instanticited. 6 Catch exceptions triggered by validation failures in set methods, then chain the exception Include all the values submitted to the constructor for instantiation of the object in the new, chained exception object. Instantiate the new, chained exception object as a Policy Exception type. d. Modify the tostring of both Auto ond HoneOwners classes to 1. Use the superclass toString method to provide bask policy Information il. Use a StringBuilder object to build the output. Requirements: Policy 1. Revise Policy ecording to the UML Class Diagram provided and these instructions 2. Validated owner new customer identifier for length of String and the integer value the String represents. Do not complete instantiation of the Policy object if the validation fails 3. Do not complete instantiation of the Policy objectif either owner of insured nomenul or all spaces 4. The policy number must have a specific structure: The first two characters must be alphabetic na numbers, special characters, or space The remaining portion of the policy number must consist of exactly 5 digits The validation must be done wig regular expression 5. Ha validation fails, throw a PolicyException. The message used to instantiate the exception objects include all values offered to the constructor. Auto 1. Modify the subclass Auto according to the UML requirements and the instructions provided here. 2. The model year be greater than 1999 and less than or equal to 2021. 3. The VIN must met specific requirements Q. It must be 17 characters long. Validate this using a String method. b. It may not contain special characters or white space. Volidate for this with a regular expression c t cannot contain the letter 1, 0or Q. Validate for this with a regular expression d. It must be al capital letter. Validate for this with a regular expression. NOTE: htems b through d may be done using a single regular expression. 4. Deductible value must be one of the following: 250, 500, 750, or 1000. No other values are Doceptable 5. Ha validation foil, throw a PolicyException. The message used to instantiate the exception objects include all values offered to the constructor 6. The tostring method wil be updated to meet the following requirements: G. For the fire portion of the output, call the supercles toString method. b. Use a StringBuilder object to build the output HomeOwners 1. Modify the subclows Homeowners according to the UML requirements and instructions as provided. 2. Property type must be digit between 1 and 5, Inclusive. If the offered value is out of range, assign the default value of 1 to the instance variable. Continue with instantiation of the object. 3. The insured value of the contents must be greater than and less than or equal to 1,000,000. Do not complete setition of the Homeowners object if the validation fails 4 The deductible must be between 1% and 10%, inclusive. Do not complete instantiation of the Homeowners object the validation fails 5. Ha validation fails, throw a PolicyException. The message used to instantiate the exception object must include of values offered to the constructor 6. The toString method will be updated to meet the following requirements: c. For the first portion of the output, call the superclass toString method. b. Use a StringBuilder object to build the output PolicyException Wrthe code for the subclass PolicyException according to the UML requirements as provided. Customer 1. Produce the clous Customer os described in the UML Class Diagram 2 Voldated customer Id for length of String di and the Integer value the String represent. Do not complete instantiation of the Customer object of the validation Polls 3. Volidote last name to ensure existence that is, the String may not be null or blank. Do not complete instantiation of the Customer object of the validation for 4. Volidate first name to ensure existe e that is the string may not be null or blank. Do not complete inventation of the Customer object of the validation for 5. Volidate the tox identifier for length and type of characters 19 digits. Do not complete instantiation of the Customer object if the validation foils. 6. We validation for throw a CustomerException. The message used to indicate the exception object mul include all values offered to the constructor CustomerException W e code for the subclass CustonerException according to the UML requirements as provided. Notes on Exceptions Exceptions thrown in the das code Policy, Auto, HomeOwners, Customer should be chained and passed up the call stock to the rest homes. Complete and meaningful messages should be provided for any/every error. Except for the requirement to indude all valves offered at the constructor level, the form and wording of exception messages is up to the team. Provided Code TestExceptionHandling.java The provided test homes contains only two les coses. Both are positive” test cases that is all the dete contained in each test come will/should pass validations. These DO NOT CONSTITUTE A COMPLETE TEST of your date validation of exception handlin. You will wo to add test comes to fully exercise oil the logk involved in your data validations and your exception handling logic. You can do this by adding test
Attributes private owner: String Policy (abstract) implements BookValue Notes This instance variable will now carry a customer identifier for the owner value. The identifier must consist of 7 digits (digits only) and the numberic value represented by the String object must be greater than 10000. If the offered value does not meet these requirements, throw a PolicyException and do not create the Policy object. Full, legal name of named insured on policy. This may not be a null String or all spaces, if the offered value is null or all spaces, throw a PolicyException and do not create the Policy object. private insured: String private polNbr: String Unique identifier for specific policy. This policy number must meet these requirements: * The first two (2) characters must be alphabetic * These will be followed by exactly 5 digits [if the offered value does not meet the requirements, throw a PolicyException and do not create the Policy object. Use a regular expression to validate the offered value. Annual premium amount for policy private polPrem: double Operations public Policy(): Policy |public Policy(String own, String insa, String nbr, double prem): Policy Description Null constructor, establishes no instance variable values Constructor accepts four (4) parameter values, calls set methods and establishes instance variable values as appropriate. public identifyContract(): String Returns polNbr public toString(): String Returns a String reference to a formatted description of the Policy object: owner owns Policy polNbr insuring insured, with a premium of polPrem. NOTES: Set & get methods are not listed here, but are assumed to be present. Further, standard naming is assumed. Attributes private EXPOSURE_RATE: double private makeModel: String private model Year: int private vin: String Auto subclass of Policy Notes Current exposure rate for Auto policies is 0.0051 or 0.51%). This is a constant value set directly in the set method. No data will be passed into the constructor for this value. This is a CONSTANT value inot an instance value set at the class level. There is no need for either set or get methods for this value Make and model of autole. Ford Fusion) Model year of auto lie, 2016). The offered value must be greater than 1999 and less than or equal to 2021. If the offered value does not meet the rquirements, throw a Policy Exception and do not create the Auto object. Vehicle identification Number – unique vehicle identifier. Must meet the following requirements: 1) 17 characters long 2) May not contain special characters or white space 3) May not contain the letters LO, O Q 4) Ony capital letters are allowed If the offered value does not meet the requirements, throw a PolicyException & do not create the Auto object. Use a String method for requirement and a regular expression for requirements 2, 3, 4 An array of integer values representing coerage limits Collision Comprehensive UIM Stated in thousands of dollars Policy deductible, stated in dollars. Acceptable values are $250, S500, $750, or $1.000. If the offered vaue does not meet the requirements, throw a PolicyException and do not create the Auto object private limits: int[3] private deduct: int Description Null constructor establishes no instance variable values Constructor accepts values (one being a three-item array of integers Operations public Auto Auto public Autol String own, String ind, String nr. double prem, String model, int year, Stringid, intim int ded Auto public producelimitsTxt): String Returns a String describing the policy deductales: Collision limits[0]. Comprehensive: limits(1), UIM: limits (2) NOTE: Amounts should be formatted as Snnnnnn public calcExposure(): double Returns a double value representing the total possible exposure if the contract becomes immediately wholly payable For Auto policies, this is calculated as the total of all limits Returns a double value representing the current total book value of the contract. For Auto policies, this calculated as premium-(calcExposure exposureRate) public calcCurrentValue(): double public tostring String Returns a String reference to a formatted description of the Auto object: owner owns Policy potr insuring insured, with a premium of polprem. This Auto policy insures a model Year makeModel, VIN Vin, with limits producel titsTxt and a $deduct. Use a StringBuilder object. Use the superclass toString method for the first part of the output. 1. Set & get methods are not listed here, but are asumed to be present. Further, standard naming is assume 2. The first portion of the toString return will come from the superclass method 3. Direct access to instance values outside set/get methods) is, as always, forbidden *VIN validation is any required to meet the stated rules. Checksum, manufacturer formatting, etc, do not need to be validated
Attributes private EXPOSURE_RATE: double private propAddress: String private propType: int Home Owners subclass of Policy Notes Current exposure rate for Homeowners policies is 0.0025 (or 0.25%). This is a constant value set directly in the set method. No data will be passed into the constructor for this value. This is a CONSTANT value (not an instance value); set at the class level. There is no need for either set or get methods for this value. Legal address of insured property Numeric code describing property type. Valid values are: 1 – single family dwelling 2-townhouse, attached 3-townhouse, detached 4- condominium 5-other eligible If the offered value is not within range, default to a value of 1. Structural coverage limit, stated in thousands of dollars. Acceptable values are greater than 0 and less than or equal to 10,000,000 If the offered value is not within range, throw a PolicyException & do not create the Homeowners object. Contents limits, stated in thousands of dollars. Acceptable values are greater than 0 and less than or equal to 1,000,000. If the offered value is not within range, throw a PolicyException and do not create the Homeowners object. Policy deductible as a percentage of total insured value (structure + contents). Acceptable values are greater than or equal to 0.01 and less than or equal to 0.10. of the offered value is not within range, throw a PolicyException and do not create the Homeowners obiect. Boolean indicating if policy is tied to umbrella coverage private structure: int private contents: int private deduct: double private umbrella: boolean Description Null constructor; establishes no instance variable values Constructor accepts values and returns a reference to a Homeowners object. Operations public Homeowners : Home Owners public Homeowners String own, String ind, String nbr, double prem, String addr, int type, int struct, int goods, double ded, boolean umbr : Homeowners public getDeductInDollars(): double Returns the dollar value of the deductible as: (structure contents) deductible public calcExposure(): double Returns a double value representing the total possible exposure if the contract becomes immediately, wholly payable. For Homeowners policies, this is calculated as the sum of structure and contents Returns a double value representing the current total book value of the contract. For Home Owners policies, this calculated as: premium calcExposure exposureRate) public calcCurrentValue): double public tostringString Returns a String reference to a formatted description of the Homeowners object: Owner owns Policy polNbr insuring insured, with a premium of polPren. This Home Owners policy insures a type propType home at propAddress. The structure is insured for $structure; contents for $contents. The deductible is $getDedcut InDoLLars. This policy is/is not part of an Umbrella contract. Use a StringBuilder object. Use the superclass toString method for the first part of the output. 1. Set & get methods are not listed here, but are assumed to be present. Further, standard naming is assume 2. The first portion of the toString return will come from the superclass method 3. Direct access to instance values (outside set/get methods) is, as always, forbidden
PolicyException subclass of some exception type Notes Attributes Operations |public PolicyException(String message ): PolicyException public PolicyException( String message, Throwable cause ): PolicyException Description One-parameter contructor; passes parameter to appropriate superclass constructor. TWO-parameter constructor; passes parameters to appropriate superclass constructor. Customer Notes Attributes private custId: String A unique identifer for the customer. This String object must consist of 7 digits; the integer value represented by the String must be greater than 10000. If the offered value does not meet these requirements, throw a CustomerException and do not create the Customer object. private lastName: String private firstName: String Legal last name or Surname) of the customer. This may not be a null String or all spaces; if the offered value is null or all spaces, throw a CustomerException and do not create the Customer object. Legal first (or given) name of the customer. This may not be a null String or all spaces, if the offered value is null or all spaces, throw a Customer Exception and do not create the Customer object. Unique IRS-issued tax identifier for customer. Must be exactly 9 digits long. if the offered value does not meet the requirements, throw a CustomerException and do no

Expert Answer


. . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *