Find Jobs
Hire Freelancers

Cat and Mouse Java Program

$10-30 USD

Cerrado
Publicado hace más de 9 años

$10-30 USD

Pagado a la entrega
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 del proyecto: 6757626

Información sobre el proyecto

18 propuestas
Proyecto remoto
Activo hace 9 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
18 freelancers están ofertando un promedio de $29 USD por este trabajo
Avatar del usuario
A proposal has not yet been provided
$35 USD en 2 días
5,0 (132 comentarios)
8,0
8,0
Avatar del usuario
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 en 1 día
5,0 (1082 comentarios)
7,6
7,6
Avatar del usuario
TOP Ranked Java programmer with 600+ reviews. I read the details and will provide you well commented code. Thanks
$30 USD en 1 día
4,8 (441 comentarios)
7,4
7,4
Avatar del usuario
A proposal has not yet been provided
$25 USD en 1 día
4,9 (630 comentarios)
6,8
6,8
Avatar del usuario
hey there, we went through this Java assignment (Cat & Mouse)...Please let us know when do you want this completed, please reply, thank you !
$38 USD en 2 días
4,9 (99 comentarios)
5,6
5,6
Avatar del usuario
Hi! I am professional C/C++/C#/Java programmer. I can do this project with highest quality. Best Regards, Szymszteinsl
$50 USD en 3 días
4,7 (53 comentarios)
5,9
5,9
Avatar del usuario
I am an expert in java and willing to discuss further about the project specifications and needs .
$54 USD en 2 días
4,9 (22 comentarios)
5,5
5,5
Avatar del usuario
Hello, I am a software engineer experienced in Java, i can complete your project within 24 hours from awarding.
$30 USD en 1 día
5,0 (27 comentarios)
4,9
4,9
Avatar del usuario
experienced Java programner, with great experience on the domian. please contact me for more information
$25 USD en 1 día
5,0 (7 comentarios)
3,6
3,6
Avatar del usuario
Hey! Pretty clear requirements. I can make this for you in one day. Does the island size need to be changeable or will it stay 5x5? Because if it can change the bridges should be calculated dynamically.. Kind regards.
$15 USD en 1 día
5,0 (14 comentarios)
3,3
3,3
Avatar del usuario
Hello, I am a mainly a web professional but I have good expertise in java also. Let me know if you are interested. Thank you Manoj Baruah
$30 USD en 1 día
5,0 (3 comentarios)
2,5
2,5
Avatar del usuario
I am a Java developer by trade. This particular problem should not be difficult. Thank You for your consideration.
$25 USD en 1 día
5,0 (1 comentario)
2,6
2,6
Avatar del usuario
I've been studying computer science for 4 years and have successfully completed many assignments like yours. I can code your cat mouse program within an hour. Please contact me for further information.
$13 USD en 0 día
4,8 (2 comentarios)
2,2
2,2
Avatar del usuario
A proposal has not yet been provided
$50 USD en 1 día
5,0 (3 comentarios)
1,9
1,9
Avatar del usuario
Requirements are clear and task seems to be easy for a commercial programmer. However it will be a little time consuming. The price is so low because of the project characteristic. It would be a lot of fun :). Do you need any kind of GUI?
$15 USD en 3 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
Bir öneri henüz sağlanmadı
$10 USD en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
I have been in this industry for 4 years and such jobs are my daily practice. This is my first time on this site and hence you can see that I do not have any ratings/testimonials to show you. I can assure you that if you work with me once, you will always work with me for these kind of projects.
$15 USD en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
This is a simple enough project, any one of us freelancers could probably do this. I certainly can, and quickly at that. The point is, none can be "better" at this than the others. I can guarantee that it gets done, the code will be easy to understand and I can do as much or as little commenting as you like. For any details surrounding the task, we can discuss that before I get started. Feel free to contact me about anything!
$25 USD en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
Philadelphia, United States
0,0
0
Miembro desde nov 20, 2014

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.