Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C# read the questions carefully and provide the code with explain The force between to objects in space is calculated using the following

This is C# read the questions carefully and provide the code with explain The force between to objects in space is calculated using the following equation:
force =GM1M2R2Where:
force = force due to gravity in newtonw
G = gravitational constant (6.67408 x 10-11 m3 kg-1 s-2)
M1= mass of object 1 Kilograms
M2= mass of object 2 in Kilograms
R2= distance between objects in meters
Write a class to represent the gravitational force between two objects.
The class should have a constant for G, a properties for the names of object 1 and 2, properties for the masses of objects one and two, a property for the radius, a read only property for the gravitational force, a calculate method and an public override ToString() method that returns a nicely formatted string reporting something like The force between earth and moon is 1.99e20.
Note: use auto properties for fields that dont need to call calculate. Use fully qualified properties for fields that affect others when they change. Call your calculate method from the appropriate set methods.
In main start a do another loop. Instantiate your class. Ask the user for the names and masses of the objects and their distance apart. Display the ToString() to the user and then ask the user if they want to do another.
image text in transcribed

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

Data Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

More Books

Students also viewed these Databases questions

Question

Describe the five elements of the listening process.

Answered: 1 week ago