Find Jobs
Hire Freelancers

Cat and Mouse Java Program -- 2

$10-30 USD

已取消
已发布超过 9 年前

$10-30 USD

货到付款
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)
项目 ID: 6705477

关于此项目

12提案
远程项目
活跃9 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
12威客以平均价$35 USD来参与此工作竞价
用户头像
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 在1天之内
4.9 (1032条评论)
7.5
7.5
用户头像
Dear sir, I am experienced java programmer and I can write well commented code for you CAT and Mouse program. Thanks
$30 USD 在1天之内
4.8 (442条评论)
7.4
7.4
用户头像
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 在2天之内
5.0 (44条评论)
5.7
5.7
用户头像
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 在1天之内
5.0 (99条评论)
5.6
5.6
用户头像
A proposal has not yet been provided
$35 USD 在2天之内
5.0 (83条评论)
5.7
5.7
用户头像
Hey there, we went through your java game details (cat & mouse)... please let us know when do you want this completed ?
$45 USD 在1天之内
4.9 (95条评论)
5.5
5.5
用户头像
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 在1天之内
4.9 (15条评论)
5.2
5.2
用户头像
Ping me if interested.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
$30 USD 在1天之内
4.7 (42条评论)
4.6
4.6
用户头像
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 在1天之内
4.9 (6条评论)
3.1
3.1
用户头像
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 在1天之内
4.6 (4条评论)
2.1
2.1
用户头像
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 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
United States
0.0
0
会员自11月 8, 2014起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。