Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I can't figure out why I'm getting docked points on this. I am given the following hint: * Hint: health value not null as expected

I can't figure out why I'm getting docked points on this. I am given the following hint:

* Hint: health value not null as expected by default constructor

The first code is the constructor and the second code is my test case. What am I doing wrong when I write the code to test the health value?

/**

* First constructor for objects of class RateEstimator.

*/

public RateEstimator()

{

this.smoker = false;

this.gender = ' ';

this.age = 0;

this.highRisk = false;

this.numTickets = 0;

this.health = "Null";

}

/**

* Test constructor #1.

*/

@Test

public void testConstructor1()

{

RateEstimator rateTest = new RateEstimator();

assertNotNull(rateTest);

// check smoker attribute value

assertFalse(rateTest.isSmoker());

// check gender attribute value

assertEquals(' ', rateTest.getGender());

// check age attribute value

assertEquals(0, rateTest.getAge());

// check high risk attribute value

assertFalse(rateTest.isHighRisk());

// check number of tickets attribute value

assertEquals(0, rateTest.getNumTickets());

// check health attribute value

assertEquals("Null", rateTest.getHealth());

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

=+3. What are the components of a social media communication audit?

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago