Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Baby Code With Test
import java.util.Calendar;
import java.util.Date;
public class BabyCode extends Code {
public Date DueDate;
public BabyCode(Code mother, Code father) {
Utility utils = new Utility();
_genes = utils.join(mother.GetReproductiveGenes(), father.GetReproductiveGenes());
protected void CalculateDueDate(Calendar date) {
DueDate = new Date(date.getTimeInMillis());
import static org.junit.Assert.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.junit.Before;
import org.junit.Test;
public class BabyCodeTests {
private BabyCode newBaby;
private Code father;
private Code mother;
public void setup() {
father = new Code("Shannon Code");
mother = new Code("Dawn Code");
public void BabyIsNotNull() throws ParseException {
mother.SetOvulationDate(new SimpleDateFormat("MM/dd/yyyy").parse("11/14/2011"));
newBaby = new BabyCode(mother,father);
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
public class Code {
private String _name;
public Code() {}
public Code(String name) {_name = name;}
protected Date _ovulationDate;
protected String[] _genes;
public String[] GetReproductiveGenes() {
return new String[]{"A", "T", "G", "C"};
public void SetOvulationDate(Date date) throws ParseException {
_ovulationDate = date;
public Calendar GetOvulationDate() {
Calendar date = Calendar.getInstance();
date.set(Calendar.DAY_OF_MONTH, _ovulationDate.getDate());
date.set(Calendar.MONTH, _ovulationDate.getMonth());
date.set(Calendar.YEAR, _ovulationDate.getYear());
return date;
Copy link

ripper234 commented Aug 8, 2014

Congratulations, even if overdue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment