Go through each method and add enough documentation to show what the code is doi
ID: 3808849 • Letter: G
Question
Go through each method and add enough documentation to show what the code is doing using JavaDoc comments (i.e /** */).
Code 1
code 2
code 3
code 4
package main; 3 import static org. junit.Assert.* 5 import org. junit.After import org. junit. Before; 7 import org. junit. Test 8 import java. sgl.Connection 9 import java.sql.SQLException; 10 12 public class DbHelperTest 13 private DbHelper helper; 14 15 @Before 16 public void in itHelper() throws SQLException helper DbHelper getInstance( 18 helper init(); 19 20 21 @After 22 public void close Helper() throws SQLException 23 helper. close 24 25 26 27 OTest public void connectionTest 28 try t 29 Connection conn helper. getConnection 30 assertNotNull("could not get database connection", conn); 31 conn. close 32 33 catch (SQLException e) 34 e.printStackTrace(); 35 36 37 38 39 40 41Explanation / Answer
Class Name: Main
Method Name: main
Description:
/**
* This method is the starting place of the program. This method throws SQLException if something is
* wrong while connecting to DB and FileNotFoundException if there is anything wrong in access of file
* @param args This is the first parameter to main method which is an array of string type arguments
* @return void.
*/
Method Name: processDataFile
Description:
/**
* This method is the starting place of the program. This method throws FileNotFoundException if there is
* anuthing wrong while accessing file and SQLException if something is wrong while connecting to DB.
* THis method reads the file and split the line by comma(,) and create the Contact object by passing name
* ,address and phone read from file.
* @return void.
*/
Class Name: DbHelperTest
Method Name: initHelper
Description:
/**
* This method throws SQLException if something is wrong while connecting to DB. Here it creates the global *instance to connect with the DB and call the init method to initialize the object.
* @return void.
*/
Method Name: closeHelper
Description:
/**
* This method throws SQLException if something is wrong while connecting to DB. Here it close the created *DbHelper object and release the allocated resources in initHelper method.
* @param args This is the first parameter to main method which is an array of string type arguments
* @return void.
*/
Method Name: connectionTest
Description:
/**
* This method throws FileNotFoundException if there is something wrong while connecting to DB.
* The pupose of this method is to check the connection.
* @return void.
*/
Class Name: Contact
Constructor Name: Contact
Description:
/**
* To initialize the Class attributes (name, address and phone)
*/
Method Name: getName
Description:
/**
* The pupose is to retrieve the property name.
* @return name.
*/
Method Name: setName
Description:
/**
* The pupose is to set the property Name.
* @param1 Name.
*/
Method Name: getAddress
Description:
/**
* The pupose is to retrieve the property Address.
* @return Address.
*/
Method Name: setAddress
Description:
/**
* The pupose is to set the property Address.
* @param1 Address.
*/
Method Name: getPhonenumber
Description:
/**
* The pupose is to retrieve the property phonenumber.
* @return phonenumber.
*/
Method Name: setPhonenumber
Description:
/**
* The pupose is to set the property Phonenumber.
* @param1 Phonenumber.
*/
Method Name: equals
Description:
/**
* This method is overriden to compare the Contact objects. BY
* if object references is for same object then two Contact object is equal.
* if phoneNumbers are equals it is considering those Contact object as equal.
* @param1 Phonenumber.
*/
Method Name: equals
Description:
/**
* This method is overriden to compare the Contact objects. BY
* if object references is for same object then two Contact object is equal.
* if phoneNumbers are equals it is considering those Contact object as equal.
* @return boolean type.
* @param1 Object type.
*/
Class Name:ContactTest
Method Name: SaveDataTest
/**
* It is creating the Contact object and then calling save() method of Cotact which is missing and then loading *the contact by ID and comparing both Contact object.
**/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.