Answered step by step
Verified Expert Solution
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 Where:
force force due to gravity in newtonw
G gravitational constant x m kg s
M mass of object Kilograms
M mass of object in Kilograms
R 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 and 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 e
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.
Step 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