Exoplanet Discovery

Exoplanets are planets outside of our solar system. So far, approximately 4800 exoplanets have been discovered. Whilst a few "lone wolf" planets have been discovered, most of the exoplanets are associated with one of approximately 3500 stars, with approximately 800 stars associated with more than one discovered exoplanet.

The vast majority of discovered exoplanets have been discovered when the they transit across our line of sight to the star that they orbit, but some have been discovered by dopler spectography and others have been imaged: see image.

It follows that larger planets are more likely to be discovered than small planets, and planets close to the star that they orbit are also more likely to be discovered than far out planets.

Planet habitability is a measure of a planet's potential to develop and maintain environments hospitable to life. The discovery of exoplanets is ongoing.

Your Task

Your task is write a program that will:-

1. Collect information from the user about discovered exoplanets.

2. Perform some calculations.

3. Display some results, including a summary of collected data in the form of a HTML table.

Your program will then perform some calculations and then display the results in the form of a HTML table.

The Three Parts of your Code.

Your program has 3 phases, as shown in the diagram above:-

  • An input phase that collects the raw data.
  • A calculation phase, that begins when the input phase is finished.
  • A display phase that begins when the calculation phase is finished. It displays calculated data as well as raw data in the form of a HTML table.

The Input Phase

Your program must allow the user to keep entering the detail for another exoplanet until such time as the user no longer wishes to. How you achieve that is up to you, but it must be easy to use and you need to make sure the user knows what to do.

You must perform interactive input by using the prompt() function (and possibly the confirm() function). Full validation of all input is required:-

For each exoplanet that the user chooses to enter, you need to get the following from the user:-

1) The name of the exoplanet. The name of the exoplanet cannot be the empty string.

2) The year of discovery of the exoplanet. The year must be an integer greater than 1900 and less than 2022.

3) The method of discovery of the exoplanet. The method of discovery of the planet must be one of the following:-

transit
doppler
imaged
other

4) The name of the star that the exoplanet belongs to. It can be any string aside from the empty string.

5) The mass of the planet. The mass of the planet is in Mj (Jupiter Masses). This is a number greater than zero and less than 100.

The Calculation Phase

The calculation phase begins when the input stage is finished, and the display phase happens when the calculations have been performed. Please do not let the phases bleed into each other. Your marker wants to see these parts of your code separately. Your program must calculate the following collective data regarding the entered exoplanets (in no particular order):-

  • Identify the lightest exoplanet.
  • Identify the heaviest exoplanet.
  • The average exoplanet mass.

The Display Phase

You program must write HTML to the document including a single table with all of the inputted information for each exoplanet entered.

If there are no planets then this must be stated.

Otherwise you must output the following:-

  • The name of the lightest exoplanet, and its weight.
  • The name of the heaviest exoplanet, and its weight.
  • The average exoplanet mass.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.