java | project | 代写assignment – 07.03 Assignment Instructions

07.03 Assignment Instructions

java | project | 代写assignment – 这个题目属于一个java的代写任务, 包括了java等方面, 这是值得参考的assignment代写的题目

java代写 代写java

Instructions: Write a program to determine the surface gravity (g) on each planet in our solar system. (The results of this assignment will be used in later lessons, but will not be submitted for a grade at this time.)

1. Create a new  project called 07 Defining New Methods in the Mod
Assignments folder.
2. Create a class called PlanetGravity in the new project folder.
3. Read the Background section below to learn how to calculate each planets
surface gravity.
4. Look over the planet data below that contains the diameter and mass of each planet. Be sure to
note the units of each value.
5. Assign the names of the planets to an array. Do the same for mass and diameter. Use a separate
array for each.
6. Use static methods to break your program down into functional sections. For each method,
determine whether parameters are needed or a return value.
7. Create a method to calculate the surface gravity for each planet. Depending on the accuracy of
your information source, calculated values should be reasonably accurate but may vary somewhat.
Be sure to double check your units.
8. Make a method to display the information in a neatly formatted table. (See sample output.)
9. Create a method to write the surface gravity data to a text file. When you inspect the file with a text
editor, there should be eight numbers, one on each row. (You will need this file in the future.)

Background: Even if you have not taken physics, you have an intuitive understanding of gravity, the force that causes an object to fall when you drop it and keeps us from drifting off into space.

The surface gravity (g) of every planet is different, but can be easily calculated using two basic measurements: the planets mass (M) and radius (r). If you have taken physics, the following equation will be very familiar. If not, simply look at it arithmetically; it only involves multiplication and division.

The following example shows how to calculate the Earths surface gravity:

where g is the surface gravity in m/s,
G is the Universal Gravitational Constant,
M is the mass of the planet in kilograms ,
r is the radius of the planet in meters.

Planet Data: In order to complete this assignment, fill in the missing data for the diameter and mass of each planet. If you locate information for the surface gravity of each planet, record it in the last column so you can compare the accuracy of your programs results.

Planet Diameter (km) Mass (kg)
Mercury 4,880 3.30e
Venus 12,103.6 4.869e
Earth 12,756.3 5.972e
Mars 6,794 6.4219e
Jupiter 142,984 1.900e
Saturn 120,536 5.68e
Uranus 51,118 8.683e
Neptune 49,532 1.0247e

Expected Output: When your program runs correctly, the output should resemble the following screen shot. Only data for Earth are shown here to help you with formatting, but each column of your output will be filled in.

  • The carat symbol ( ^ ) is used in the heading of the last column to indicate that the unit for seconds (s) is squared. In some languages, arithmetic expressions can be raised to a power with the carat symbol, but in java you must use the Math.pow() method. In this case, the ^ is part of a String literal, not an arithmetic expression.

** The data in column three are printed in scientific notation (e.g. 5.97E+24). The printf() method has additional type converters that can be used in the format specifier. The letter "E" (upper- or lowercase) is the conversion specifier for scientific notation (e.g. %7.2E).