Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview For this assignment, write a C + + program to calculate and display the gravitational force between two objects. Basic Program Logic The first
Overview
For this assignment, write a program to calculate and display the gravitational force between two objects.
Basic Program Logic
The first thing to do in the program is to create any variables that are needed to holdsave information for the program. To determine how many variables are needed, think about the information that will be entered by someone using the program and whether it is important for that information to be saved. Think about any calculations that will be performed by the program and whether the results of the calculations need to be saved. To determine the data type for the variables, think about what values someone using the program will be entering or what kind of results will be produced by any calculations. Note: to ease into writing this first program, the data type for the variables has been specified below.
Ask the user of the program for the mass in kilograms of the first object. This value should be saved in a float or double variable.
Ask the user of the program for the mass in kilograms of the second object. This value should be saved in a float or double variable.
Ask the user of the program for the distance in meters between the two objects. This value should be saved in a float or double variable.
Use the three variables from above to calculate the gravitational force between the two objects formula follows Depending on how the code is written, if the calculated gravitational force is saved in a variable, it should be type float or double.
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