Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(5 pts) Problem 2 You've just started a tw game studio! In a show of highly questionable decision making you opt to massively-multiplayer online game

image text in transcribed
(5 pts) Problem 2 You've just started a tw game studio! In a show of highly questionable decision making you opt to massively-multiplayer online game for your first project. Within your game world, you want to have schools of fish that regularly appear in the ocean. Since you want your game's players to be able to fish from these schools, the fish should appear close to the shoreline. For now, let's assume that your game world contains a single circular landmass of radius r centered about the point (h, k). Given a random spawn point (x,y) for your fish, you want to determine the distance of that point from the shoreline. Let's do some algebra! Using the distance formula, the distance of the spawn point (x, y) from the center of the circular landmass (1,k) is vir-h) + (y-2). Or that distance, r is taken up by the landmass itself. So the distance d from (x,y) to the shoreline is just the difference: d = V(x - h) + (y - k) - (1) Note that a positive value for d indicates that your fish are in the ocean; a zero value for d indicates that your fish are right on the shoreline; and a negative value for d indicates that your fish have somehe appeared on land (which could make for an interesting game). Within your Lab2 folder, write a program named DistanceChecker.java that allows the user to enter inputs for r, , k, and the location of the fish spawn point (ac,y). All of the inputs should allow decimals. Your program should then compute and display the distance d using equation (1). Here's an example of what your completed program might look like when you run it. Underlined parts indicate what you type in as the program is running. What is the radius of your circular landmass? 50 What are the x and y coordinates of the center of your landmass? 12 17 What are the x and y coordinates of your fish spawn point? 175 -54 The fish are a distance of 127.79201331893398 from the shoreline

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

Students also viewed these Databases questions

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago