Question

can you please fix this code because it says that it has some syntax errors. because...

can you please fix this code because it says that it has some syntax errors. because it keeps on tell me that there are three errors in this code and I cannot seem to find it. please write the correct code in the answer box.

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
* The test class ClientTest tests the Client class.
*
* @author Doyt Perry/<add your name here>.
* @version Fall 2019
*/
public class ClientTest
{
/**
* Default constructor for test class ClientTest.
*/
public ClientTest()
{
// not used in this Lab
}

/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@Before
public void setUp()
{
// not used in this Lab
}

/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
@After
public void tearDown()
{
// not used in this Lab
}
  
/**
* Test Client constructor #1 (no parameters).
*/
@Test
public void testConstructor1()
{

// Create a client object using the constructor with no parameters.
Client tstClient = new Client();
  
// Verify instance variables have been set to placeholder values
assertEquals("last name", tstClient.getLastName());
assertEquals("first name",tstClient.getFirstName());
assertEquals(0, tstClient.getAge());
assertEquals(1, tstClient.getHeight());
assertEquals(1, tstClient.getWeight());
}
  
/**
* Test Client constructor #2 (5 parameters).
*/
@Test
public void testConstructor2()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// Verify instance variables have been set to the passed in values
assertEquals("Smith", tstClient.getLastName());
assertEquals("Carl", tstClient.getFirstName());
assertEquals(44, tstClient.getAge());
assertEquals(70, tstClient.getHeight());
assertEquals(1, tstClient.getWeight());
  
  
}
  
/**
* Test setLastName method.
*/
@Test
public void testSetLastName()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// set the last name to a new value
tstClient.setLastName("Smithsonian");
  
// Verify last name has been set to new value
assertEquals("Smithsonian", tstClient.getLastName());
}

/**
* Test set setFirstName method.
*/
@Test
public void testSetFirstName()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// set the first name to a new value
tstClient.setFirstName("Robert");
  
// Verify first name has been set to new value
assertEquals("Robert", tstClient.get.FirstName());
}

/**
* Test setAge method.
*/
@Test
public void testSetAge()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// set age to a new value
tstClient.setAge(39);
  
assertEquals(39, tstClient.getAge());
  
  
  
}

/**
* Test setHeight method.
*/
@Test
public void testSetHeight()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// set height to a new value
tstClient.setHeight(66);
  
// Verify height has been set to new value
assertEquals(66, tstClient.getHeight());
}
  
  
/**
* Test setWeight method.
*/
@Test
public void testSetWeight()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// set weight to a new value
tstClient.setWeight(180);
  
// Verify weight has been set to new value
assertEquals(180, tstClient.getWeight());
  
// REPLACE these comments with code that sets the weight to
// a different value & then verifies the updating has been done
}
  
/**
* Test calcBMI method.
*
* NOTE TO 111 STUDENTS: This test method IS correct!!!
* DO NOT MODIFY IT
*
*/
@Test
public void testCalcBMI()
{
// Create a client object using the constructor with 5 parameters.
Client tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// Verify BMI has been correctly calculated (with delta of.01)
assertEquals(28.69, tstClient.calcBMI(), .1);
}
  
/**
* Test the toString method.
*
* NOTE TO 111 STUDENTS: This test method IS correct!!!
* DO NOT MODIFY IT
*
*/
@Test
public void testToString()
{
// Create a client object using the constructor with no parameters.
Client tstClient = new Client();
  
// call the toString() method to retrieve the output
String tstOutput = tstClient.toString();
  
// verify client name is in correct output format
assertTrue(tstOutput.contains("last name, first name"));
// verify client age is included in output stream
assertTrue(tstOutput.contains("0"));
// verify BMI is correctly calculated
assertTrue(tstOutput.contains("703.0"));
  
// Create a client object using the constructor with 5 parameters.
tstClient = new Client("Smith", "Carl", 44, 70, 200);
  
// call the toString() method to retrieve the output
tstOutput = tstClient.toString();
  
// verify client name is in correct output format
assertTrue(tstOutput.contains("Smith, Carl"));
// verify client age is included in output stream
assertTrue(tstOutput.contains("44"));
// verify client BM is correctly calculated
assertTrue(tstOutput.contains("28."));
}
  
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Only error i found here is

// Verify first name has been set to new value
assertEquals("Robert", tstClient.get.FirstName());
}

change 'tstClient.get.FirstName()' to 'tstClient.getFirstName()'.

Please let me know if u catch any other error, and it could be better if you can put Client.class file

Add a comment
Know the answer?
Add Answer to:
can you please fix this code because it says that it has some syntax errors. because...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT