Answered step by step
Verified Expert Solution
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
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 400Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started