Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this code Must be in java and object oriented. blert is created using the 2 overloaded Repeat the previous step, however, the

image text in transcribedNeed help with this code
Must be in java
and object oriented.
blert is created using the 2 overloaded Repeat the previous step, however, the Lab Assignment 2 Modify the code, such that the user is asked for three values, representing the name diameter and temperature for the celelal object. These inguts are then used to create a celestial object, with those attributes using the fest overloaded constructor mentioned above. Next, print the created celestial object's attributes onto the screen. Then run the program several times, Inputting bad and good values for the name diameter and emre , and verify that the overloaded constructor hered the bad values. Prerequisite toples Overloading of constructors The testing method Quedate 3 days Dellverables As described by professor Sawh Make the following changes to the class CelestialObject: a) Add an overloaded constructor which takes three parameters in the order specified): a Sering a double and an int, which respectively represent the celestial object's game d ate and b] Add another overloaded constructor, which takes as parameter only 1 parameter: a Sering which represents the name of the file, which contains the passe dameter and temperature of the celestial object being created. c) Make a tostring) method, which helps the compiler convert a Celestial object in a string of format: Kelvin celeste/object, nomed xxx, with a diameter of miles and beneature of where ww ww and represent the object's named ameter and temperature. Create the client code, which tests the toString method, and the two overloaded constructors. Use the following methodology: Keep the testing code, used in Lab Asment 1 lust add the new code below) Create a celestial object using the default constructor, and then convert the object into a String using the toString() method, which is then given to the printin) method to be printed onto the screen. Repeat the previous step, however, create the 2 object using the first mentioned overloaded constructor See the file www.havio to/reading data from files CPI Pediadomes for information on writing

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago