Question

This is my exact question. But i need a step by step process example in understanding...

This is my exact question. But i need a step by step process example in understanding how to use Kepler's 3rd law to solve this.

Write a program that asks the user for the name of a planet and the distance of that planet from the Sun in AU’s. The program should than calculate a ‘year’ on that planet in Earth years and output the information to the user. Use user friendly prompts. Be sure to include a comment at the beginning of the program with your name, date, and a short description of the program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

As per Kepler's Law T^2 \propto R^3 where T is the period of rotation and R is the distance from the sun. Hence
\frac{T_P^2}{T_E^2} = \frac{R_P^3}{R_E^3}

where T_P,R_P,T_E,R_E are the time period of the planet, distance of the planet, time period of Earth, the distance of Earth respectively.

Note that the time period of Earth is 1 year, while the distance is 1 AU.

Hence T_P^2 = R_P^3 where the time period is in Earth years, and the distance is in AU. This gives T_P = R_P^{\frac{3}{2}} .

Here is the code which does this as required (in C++), let me know if you need some other language:

# include <iostream>
# include <cmath>
using namespace std;

int main() {
//take user input
string name;
double dist;
cout << "Please enter the name and the distance of the planet from the sun: ";

//output the time period using Kepler's law now
cin >> name >> dist;
cout << "The rotation period of " << name << " in Earth years is: " << pow(dist, 1.5) << endl;
return 0;
}

Please enter the name and the distance of the planet from the sun: Venus 0.723 The rotation period of Venus in Earth years is

Please enter the name and the distance of the planet from the sun: Mars 1.524 The rotation period of Mars in Earth years is:

Comment in case of any doubts.

Add a comment
Know the answer?
Add Answer to:
This is my exact question. But i need a step by step process example in understanding...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello! I need help setting my program up to initiate certain tasks! We are using a...

    Hello! I need help setting my program up to initiate certain tasks! We are using a Centos Server as a root user! Use the CentOS Server and as root user perform the following: Setup two ext4 partitions on /dev/sdc at 1 GB each Mount sdc1 to /var/www (create any directories as needed) Mount sdc2 to /var/data (create any directories as needed) Install the httpd package Create a file called final.txt in /var/www/html (in that put your name/date on the first...

  • Hello in C#. I need help understanding and knwoing what i missed in my program. The...

    Hello in C#. I need help understanding and knwoing what i missed in my program. The issue is, the program is supposed to have user input for 12 family members and at the end of the 12 it asks for user to input a name to search for. When i put a correct name, it always gives me a relative not found message. WHat did i miss. And can you adjust the new code so im able to see where...

  • Multivariable Calculus help with the magnitude of angular momentum: My questions is exercise 4 but I have attached exercise 1 and other notes that I was provided 4 Exercise 4. In any mechanics proble...

    Multivariable Calculus help with the magnitude of angular momentum: My questions is exercise 4 but I have attached exercise 1 and other notes that I was provided 4 Exercise 4. In any mechanics problem where the mass m is constant, the position vector F sweeps out equal areas in equal times the magnitude of the angular momentum ILI is conserved (Note: be sure to prove "if and only if") (Note: don't try to use Exercise 2 in the proof of...

  • I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instruction...

    I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...

  • I have already turned in my HW, I need some understanding of the below SQL queries....

    I have already turned in my HW, I need some understanding of the below SQL queries. 1. Find the number of employees in each department. 2. List the names of departments that have more than 5 employees working there. 3. Retrieve the lowest and highest salary in each department. Output the department name in alphabetical order. Consider the following relational schema. An employee can work in more than on department; also, the percentTime field of the Works relations shows the...

  • Step 2: Create the method specified below. static int GetValidWidth(string prompt) Input parameters prompt: message for...

    Step 2: Create the method specified below. static int GetValidWidth(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero width entered by the user Step 3: Create the method specified below. static int GetValidHeight(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero positive height entered by the user Step 4: Create the method specified below. static void DisplayBox(int width, int height, char fillChar) Input parameters width: width of each...

  • Below is the picture for the direction of my program and also the part where I...

    Below is the picture for the direction of my program and also the part where I have problems with I've already finished it and my code works correctly. But what I need to do is to "read the file name from the command line arguments" instead of the standard input (cin) that I did for step 1. I'm not sure how to do that. 2.13 PROGRAM 1: Calculating Coefficient Of Lift For this PROGRAM you will calculate the coefficient of...

  • I need help making my array into a function that can called by the main function...

    I need help making my array into a function that can called by the main function using my program. This is C programming int prime (int x) { int i; i = 2; while (i < x) { if (x % i == 0) return 0; i++; } return 1; } int main (void){ int n; scanf ("%d", &n); if (n < 1) { printf ("Error: at least one data value must be provided.\n"); return 1; } int a[n]; int...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

  • I need help with my C coding homework. If possible can you please comment to help...

    I need help with my C coding homework. If possible can you please comment to help me understand whats going on in the code. Thanks in advance. Create a C program (3 points): o At the top of the file include the following comments: Your name The purpose (core concept found below) of the program The date created o Create two int variables: Initialize each to different values. o Create three pointers: Point the first two pointers to the first...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT