The File Must Be Called Lastfirstweek5catmouse.java (driver

Mammal.java

Cat.java (which extends Mammal)a

Mouse.java (which extends Mammal)

Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only. If possible, submit all programs as a single .zip file (not required) Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter.

Overall Requirements Write a program that simulates the battle between a cat and mice.

Cat Kills 1 mouse a day

Does not reproduce

Mice Have a chance to reproduce as long as conditions are met

Reproduction only happens when mice are over 1 and 1 of each sex is present

Simulation Control

Simulation continues as long as population is greater than 1 and less than 10

Driver main method should be as shown below: (replacing comment with missing piece)

import java.util.ArrayList;

public class LastFirstWeek5CatMouse
{
public static void main(String [] args)
{

cat sylvester = new cat();
ArrayList mice = new ArrayList();
mice.add(new mouse());
mice.add(new mouse());
mice.add(new mouse());
mice.get(0).setSex(true);
mice.get(1).setSex(false);
mice.get(2).setSex(false);

while (mice.size() >1

Leave a Reply

Your email address will not be published. Required fields are marked *