Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This portion of code is looking to see if there is a premium increase or decrease depending on certain factors. Some factors are liabilities like

This portion of code is looking to see if there is a premium increase or decrease depending on certain factors. Some factors are liabilities like smoking, high risk status, or poor health. Some are assets, like non-smoker, good health and low risk status.

It is asking us to write certain criteria then assign either asset or liability, At the end, we need code that says if there are 3 or more assets, then subtract 15.00 from premium. If there are 3 or more liabilities, then add 65.00 to the premium.

I keep getting the error "Missing Return Statement" at the end of the code and can't figure out why. Can anyone provide some help?

/**

* Calculate demographics-related rate adjustment.

*

* @param inSmoker whether or not candidate is a smoker.

* @param inAge age of candidate.

* @param inHighRisk whether or not candidate is high risk.

* @param inNumTickets number of traffic tickets for candidate.

* @param inHealth candidate health status (Good, Fair, Poor).

* @return double monthly premium adjustment.

*

*/

public static double calcDemogAdj(int inAge, boolean inSmoker,

boolean inHighRisk, int inNumTickets, String inHealth)

{

// Variable to count factors that contribute to premium decrease

int asset = 0;

// Variable to count factors that contribute to premium increase

int liability = 0;

// Variable to hold rate adjustment

double rateAdjustment = 0;

// Determine if demographic data counts toward increase/decrease

if (inAge < 25)

{

++asset;

}

if (inSmoker)

{

++liability;

}

else

{

++asset;

}

if (inHighRisk)

{

++liability;

}

else

{

++asset;

}

if (inHealth == "Poor")

{

++liability;

}

if (inHealth == "Good")

{

++asset;

}

if (inNumTickets == 0)

{

++asset;

}

if (inNumTickets == 3)

{

++liability;

}

// were there enough factors to decrease premium?

if (asset >= 3)

{

rateAdjustment = -15.00;

}

if (liability >= 3)

{

rateAdjustment = 65.00;

}

} Says Missing Return Statement

}

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_2

Step: 3

blur-text-image_3

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago