Find Jobs
Hire Freelancers

Cat and Mouse Java Program -- 2

$10-30 USD

Cancelled
Posted over 9 years ago

$10-30 USD

Paid on delivery
Assignment - Cat & Mouse Island Okay, we'll be playing a little game. Imagine an island (okay, a 5x5 grid). This island is surrounded by water, and there are 6 bridges off of the island. On the island is a hungry cat, and a scared mouse. The cat is hungry, but it's his island, and he won't leave it. The mouse, of course, will escape, if he finds a bridge. Sadly, in his fright, he might run into the water and drown (had a terrible experience as a young mouse, never learned to swim). At the beginning of the game, both the cat and the mouse are placed randomly on the island proper. The bridges are roughly evenly–spaced, 2 on each side. Island as a grid I'd recommend extending the coordinate system to include the bridges and the immediately surrounding water. Create an Animal abstract class. It'll have a protected attribute, of type Point, its location on the map, and a private String attribute, the animal's name. You'll need to add other attributes, as well. It'll define these methods: String getName() Point getLocation() void setStartLocation() Animal will have a single constructor, that takes a String (the animal's name), a Random object (the single random number generator that everybody will use). It'll store these values as instance variables (attributes). Animal( String name, Random rng ) It'll also declare an abstract method: void move() Inherit from Animal to create a Cat class; override the move method, to randomly move north, south, east or west. Again, the cat will not jump in the water, nor will it cross a bridge. It'll have a single constructor, that takes a String, calls the parent class' constructor to set the name. Also create a Mouse class from Animal; again, override the move method, to randomly move north, south, east or west. If the mouse drowns or escapes he won't make any more moves. You might need to keep (and initialize) another attribute, to track the mouse's mobility. It also has a single constructor, to set the name. Finally, create a Chase class, which'll have a static playGame method, which plays a single game, and returns a status (cat had a snack, mouse escaped, mouse drowned). Randomly choose a starting point for each animal. To be fair, if they start on the same spot, pick another start for one of the animals. The mouse moves first; if he lands on a square that has a bridge he escapes, the game is done. If he falls in the water, the game is also done. Then the cat gets to move; if he lands on the same spot, he gets a snack, and play is over. In the Chase class, write a main method which'll play the game 30 times, and report the outcome, to standard out, in a single line. You may add any (non-public) helper methods to any class that you find useful. Picking random numbers You'll want to create a Random object, and use the nextInt( n ) method. There will be only one generator for the entire program; create it (once) in the main driver, and pass it to your animals as you create them. Input None Output You are to print the result of each of 30 trials to stdout, one result per line, single spaced. After all the trials print a blank line, then report 3 statistics: The % of times the mouse escaped, drowned, and was eaten. What to hand in [login to view URL] [login to view URL] [login to view URL] [login to view URL] README – (opt)
Project ID: 6705477

About the project

12 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
12 freelancers are bidding on average $35 USD for this job
User Avatar
Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my Java and algorithm skills. I am focused mostly on doing computer science work here in freelancer.com and I would like to help you get this project done if you would give me the opportunity. I am a computer science professor and practitioner and this assignment is one of the fields that I teach very well so I can assure you an accurate result. Let me know if you are interested so I can start. Thanks.
$30 USD in 1 day
4.9 (1032 reviews)
7.5
7.5
User Avatar
Dear sir, I am experienced java programmer and I can write well commented code for you CAT and Mouse program. Thanks
$30 USD in 1 day
4.8 (442 reviews)
7.4
7.4
User Avatar
Hello sir. I have 5 years of java programming experience. I think I can make this simple simulation in 1 or 2 days starting on monday. The only questions I have at this time is if it's going to be just a console simulation (absolutely no graphics) and if each turn should have a duration or they happen all instantly one after the other. Please contact me to discuss these details..
$45 USD in 2 days
5.0 (44 reviews)
5.7
5.7
User Avatar
Dear sir, I have done many projects in java for student and got some positive feedback from clients. You can check my profile for more information. Let me help you. I'm ready to get started right now. Thanks and best regards, Tinh Nguyen
$30 USD in 1 day
5.0 (99 reviews)
5.6
5.6
User Avatar
A proposal has not yet been provided
$35 USD in 2 days
5.0 (83 reviews)
5.7
5.7
User Avatar
Hey there, we went through your java game details (cat & mouse)... please let us know when do you want this completed ?
$45 USD in 1 day
4.9 (95 reviews)
5.5
5.5
User Avatar
I have 15+ years of experience in Java and Web technologies. If you wish to take this forward, please PM me here on Freelancer. If I am not available online do send me a mail on neelancer at outlook dot com. Looking forward to hearing from you.
$30 USD in 1 day
4.9 (15 reviews)
5.2
5.2
User Avatar
Ping me if interested.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
$30 USD in 1 day
4.7 (42 reviews)
4.6
4.6
User Avatar
Hi. I am expert in Java and Object oriented design. Indeed I work teaching students in this subject. I use to do this kind of jobs. Best regards.
$30 USD in 1 day
4.9 (6 reviews)
3.1
3.1
User Avatar
It's a TA here. I can make this done. Please let me do this. I am familiar with this kind of problem.
$30 USD in 1 day
4.6 (4 reviews)
2.1
2.1
User Avatar
Hello. We are a team of 6 peoples(programers of c,c++,c#,java,javascript,jsp,struts...etc.). We are capable of carrying out presented contents well. Once awarded the bid,We can finish this project in time. Even if we are beginners in freelancer.com, like to believe you. Can you contact us? Good Luck!
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
0.0
0
Member since Nov 8, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.