Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can some one solve this plzz Question 2: Searching for Artifacts (20 points) For this question, you will modify the above classes in order to

image text in transcribedimage text in transcribed

can some one solve this plzz

Question 2: Searching for Artifacts (20 points) For this question, you will modify the above classes in order to add searching for alien artifacts. Make sure that your code works for the first question before you try this question Page 7 Note that you only hand in one set of files for this assignment (a) Planet Add two methods to the Planet class to handle searching for artifacts on a Planet A searchForArtifact method which returns true or false whether an artifact was found. First, a random number from 0 to 1 is generated. Return true if the random number is below the chance to find an artifact, otherwise false. The chance to find an artifact is an attribute of the Planet - For example, if the chance to find an artifact is 0, then it is impossible to generate a random number below this, and artifact searching will always fail - Use the Random class to generate the random numbers, and do not use a seed. A getDamageTaken method which returns the amount of damage taken by a spaceship when searching for an artifact (corrosive gases, running into terrain, etc.) - Generate a random number from 0 to 1, and multiply that number by the possible damage which is an attribute of the Planet. Return this value as a double - Use the Random class, and do not use a seed. - For example, the possible damage for searching Jupiter is from 0 to 400 Question 2: Searching for Artifacts (20 points) For this question, you will modify the above classes in order to add searching for alien artifacts. Make sure that your code works for the first question before you try this question Page 7 Note that you only hand in one set of files for this assignment (a) Planet Add two methods to the Planet class to handle searching for artifacts on a Planet A searchForArtifact method which returns true or false whether an artifact was found. First, a random number from 0 to 1 is generated. Return true if the random number is below the chance to find an artifact, otherwise false. The chance to find an artifact is an attribute of the Planet - For example, if the chance to find an artifact is 0, then it is impossible to generate a random number below this, and artifact searching will always fail - Use the Random class to generate the random numbers, and do not use a seed. A getDamageTaken method which returns the amount of damage taken by a spaceship when searching for an artifact (corrosive gases, running into terrain, etc.) - Generate a random number from 0 to 1, and multiply that number by the possible damage which is an attribute of the Planet. Return this value as a double - Use the Random class, and do not use a seed. - For example, the possible damage for searching Jupiter is from 0 to 400

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

What are the characteristics of a mature industry?

Answered: 1 week ago