1. Homepage
  2. Coding
  3. CS 245 Advanced Programming and Data Structures - Assignment 2 - Mouse Simulation

CS 245 Advanced Programming and Data Structures - Assignment 2 - Mouse Simulation

Get in Touch with Our Experts
UWECCS245Advanced Programming and Data StructuresJavaMouse Simulation

CS 245: Advanced Programming and Data Structures Assignment Writing Service

Fall 2024 Assignment Writing Service

Assignment 2 Assignment Writing Service

  Assignment Writing Service

Assigned:        Tuesday, October 1, 2024, on Canvas Assignment Writing Service

Due Date:        Monday, October 14, 2024 (by 11:59 pm), on Canvas Assignment Writing Service

Max Score:     200 Assignment Writing Service

  Assignment Writing Service

Assignment Task: Assignment Writing Service

  Assignment Writing Service

Mouse and Cat Simulation Assignment Writing Service

This assignment will have you practice developing an OOP as a Java solution and have safe trip . You are to write classes that define a Mouse, Mouse.java, and a Cat, Cat.java. These classes will not have a main method. Assignment Writing Service

Subsequently, develop Jave code on that will run a simulation, MouseSimulation.java, using your Mouse and Cat classes. This class will be your driver / runner to verify / test the project you’ve developed. Assignment Writing Service

You are required to use those file and class names. Assignment Writing Service

What are Mice? Assignment Writing Service

They are tiny mammals with long tails, whiskers, and round ears! Only females can have a litter of baby mice. The gestation period for a mouse is 20 days on average. Female mice can get pregnant/breed again a week (7 days) after giving birth to a litter. Mice will breed for the first time at 40 days old. The probability of producing a female in a litter is equal to the probability of producing a male. Litter sizes can vary between 6 and 8. The litter size can be different for each pregnancy. Assignment Writing Service


What are Cats?
Assignment Writing Service

They are small mammals with long tails, claws, and whiskers! Cats hunt & eat mice. Each day, a cat goes hunting, with a chance of failure which is dependent on the number of cats and mice in the population. If a cat doesn’t eat for 5 days in a row, they will die. Only female cats can have a litter of kittens. The gestation period for a cat is 65 days on average. Female cats can get pregnant / breed again 4 months (120 days) after giving birth. Cats will breed for the first time at 180 days old. The probability of producing a female in a litter is equal to the probability of producing a male. Litter sizes vary between 2 and 10. Litter size can be different for each pregnancy. Assignment Writing Service

  Assignment Writing Service

What you need to do: Assignment Writing Service

Create classes called Mice.java to model the Mouse and Cat.java to model the Cat. Your mice and cats will need a biological sex, age, and other fields to help you determine if it is pregnant, how many days of the gestation has passed, and how many days after the delivery of the last litter. You will also need to have methods to give the animals the ability to have variable numbers of offspring per litter. For each pregnancy, the litter size can vary. You will need to have some way of tracking when a cat last ate, and what happens when a cat eats a mouse. The chance of failure each day a cat goes hunting is equal to: Assignment Writing Service

  Assignment Writing Service

            failure rate (f) = Assignment Writing Service

where the number of cats and mice are equal to the total values in the population on that specific day. Assignment Writing Service

You will need to write a Client (Driver) Class called MouseSimulation.java that will simulate the growth of a population of mice and cats that starts with a given number of male and female animals at day zero. Assignment Writing Service

The seed (initial) population of cats and mice will be read from an input text file (Assign-1_New-Input-Values.txt). In the input.txt file, the first integer will be the initial population of female mice, the second integer will be the initial population of male mice, the third integer will be the initial population of female cats, and the fourth integer will be the initial population of male cats. All animals in the seed population are adults (they can breed / become-pregnant immediately). The numbers will be tab delimited. Please remember to save the input.txt file directly in the IntelliJ project folder. Assignment Writing Service

An example of input.txt is shown below: Assignment Writing Service

            23   10   2   1 Assignment Writing Service

            55   29   1   5 Assignment Writing Service

            12    3    3   2 Assignment Writing Service

In the example above, there are only three initial seed populations provided. The first row, for example, has an initial population of 23 female mice, 10 male mice, 2 female cats, and 1 male cat. Ensure that your solution can handle input files that may have a varying number of rows! Assignment Writing Service

For each of these different seed populations, you must run different trials. Assignment Writing Service

  Assignment Writing Service

  Assignment Writing Service

  Assignment Writing Service

A single trial: Assignment Writing Service

Increase the elapsed time by 1 day at a time and answer the following questions: Assignment Writing Service

·      How many mice will there be produced after 1 year (365 days – should this be a constant?) Assignment Writing Service

·      How many cats will be produced after 1 year (365 days – should this be a constant?) Assignment Writing Service

To answer the question, you must have an approach of storing your mice and cats as you produce them. Use an ArrayList of type Mouse or Cat to do this. Seed this ArrayList with the initial population of mice and cats and add the new litters to it as they are produced. Assignment Writing Service

Report the final population of total animals (Mice and Cats), female animals and male animals. (You need to return an integer array you used for tallying). Assignment Writing Service

Now repeat the trial 10 times: Assignment Writing Service

Your simulation should repeat this trial 10 times (This should be a constant).  Reporting the stats for each round (total mice, female mice, male mice, total cats, female cats, male cats). Assignment Writing Service

Use a 2-D array to store the trial data (Example index 0 stores the array of tallies for the first trial). This organizes your data like a spreadsheet. The first column is the total mouse population, the second column is the female mouse population, the third is the male mouse population, and so on. Each row is a different trial. Assignment Writing Service

Given the data for the 10 trials, report the average number of each animal (mice and cats) with its standard deviation, the average number of female animals with its standard deviation, and the average number of male animals with its standard deviation. The averages and standard deviations should report only have three digits after the decimal point. Assignment Writing Service

Sample outputs below are based on the given sample input file above (remember there is randomness in determining sex, litter size, and predation so your output will vary. There will be another set of this output for each line in the input file): Assignment Writing Service

    Starting with 23 female mice, 10 male mice, 2 female cats, and 1 male cat: Assignment Writing Service

    Trial 0: 431 total mice; 201 females, 230 males. 20 total cats; 8 females, 12 males. Assignment Writing Service

    Trial 1: 340 total mice; 173 females, 167 males. 24 total cats; 13 females, 11 males. Assignment Writing Service

    Trial 2: 498 total mice; 256 females, 242 males. 17 total cats; 9 females, 8 males. Assignment Writing Service

    Trial 3: 323 total mice; 162 females, 161 males. 27 total cats; 15 females, 12 males. Assignment Writing Service

    Trial 4: 418 total mice; 209 females, 209 males. 19 total cats; 7 females, 12 males. Assignment Writing Service

    Trial 5: 361 total mice; 179 females, 182 males. 24 total cats; 11 females, 13 males. Assignment Writing Service

    Trial 6: 443 total mice; 235 females, 208 males. 18 total cats; 7 females, 11 males. Assignment Writing Service

    Trial 7: 407 total mice; 212 females, 195 males. 20 total cats; 13 females, 7 males. Assignment Writing Service

    Trial 8: 397 total mice; 204 females, 193 males. 23 total cats; 11 females, 12 males. Assignment Writing Service

    Trial 9: 313 total mice; 159 females, 154 males. 28 total cats; 14 females, 14 males. Assignment Writing Service

            Assignment Writing Service

    Average number of mice: 393.100 with standard deviation of 55.623. Assignment Writing Service

    Average number of female mice: 199.000 with standard deviation of 29.813. Assignment Writing Service

    Average number of male mice: 194.100 with standard deviation of 27.541. Assignment Writing Service

    Average number of cats: 22.000 with standard deviation of 3.578 Assignment Writing Service

    Average number of female cats: 10.800 with standard deviation of 2.786 Assignment Writing Service

The format of your output should match the above example. Assignment Writing Service

Note: The values shown are only examples and may differ from what you get as output values. Assignment Writing Service

Strategy: Assignment Writing Service

·      Create your Mouse class. Assignment Writing Service

o   Write your getter and setters and helper methods. Assignment Writing Service

·      In your Driver create a Mouse object and test that your methods work correctly. Assignment Writing Service

Once you have verified your Mouse  class works correctly, do the same for the Cat class, and then, Assignment Writing Service

·      Write a method to run one trial of your experiment. Assignment Writing Service

o   Populate your ArrayList of Mice and Cats with the correct number of seeds read from the input.text file. Assignment Writing Service

o   For the number of days in your trial Assignment Writing Service

§  Age each animal. Assignment Writing Service

§  If it is pregnant – add a day to its gestational period. Assignment Writing Service

§  If it can breed – let it breed. Assignment Writing Service

§  If it can give birth – let it give birth (add litter to animal population) Assignment Writing Service

§  See if it has a successful hunt that day. Assignment Writing Service

§  Did it die? Assignment Writing Service

·      Report/record the results of that trial in an integer array (print to verify then for final comment it out) Assignment Writing Service

·      Repeat this trial 10 times recording each trial data in a 2dD array (print to verify then for final comment it out) Assignment Writing Service

·      Report the averages and standard deviations. Assignment Writing Service

·      Make sure your output is formatted like mine (see above). Assignment Writing Service

  Assignment Writing Service

Use meaningful names for methods and variables. Incorporate good horizontal and vertical indentation and whitespace in your code layout structure. Assignment Writing Service

Include a header comment block at the top of all your .java files, and in that, include your full name and the purpose of that file. Assignment Writing Service

  Assignment Writing Service

Submission: Assignment Writing Service

  Assignment Writing Service

Please zip your IntelliJ Java project folder and submit the zipped file under the Assignment 2 on Canvas folder. To grade your work, I should be able to simply unzip your Java project, load it in the IntelliJ environment, and run it. Assignment Writing Service

  Assignment Writing Service

Academic Integrity Note: Assignment Writing Service

  Assignment Writing Service

Every student must work independently (strictly on their own) and must not collaborate or communicate with their peers (students) in CS 245 or other courses. Assignment Writing Service

  Assignment Writing Service

  Assignment Writing Service

If you have any questions, please seek guidance from any of the two TAs and/or me. Assignment Writing Service

  Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
UWEC代写,CS245代写,Advanced Programming and Data Structures代写,Java代写,Mouse Simulation代写,UWEC代编,CS245代编,Advanced Programming and Data Structures代编,Java代编,Mouse Simulation代编,UWEC代考,CS245代考,Advanced Programming and Data Structures代考,Java代考,Mouse Simulation代考,UWEC代做,CS245代做,Advanced Programming and Data Structures代做,Java代做,Mouse Simulation代做,UWEChelp,CS245help,Advanced Programming and Data Structureshelp,Javahelp,Mouse Simulationhelp,UWEC作业代写,CS245作业代写,Advanced Programming and Data Structures作业代写,Java作业代写,Mouse Simulation作业代写,UWEC编程代写,CS245编程代写,Advanced Programming and Data Structures编程代写,Java编程代写,Mouse Simulation编程代写,UWEC作业答案,CS245作业答案,Advanced Programming and Data Structures作业答案,Java作业答案,Mouse Simulation作业答案,