C++ Star Luminosity and Type Calculator

Full code: GitHub

This program calculates the luminosity, precise star type, and habitable zone of a star by using only its radius and surface temp.  Luminosity is the total amount of energy that a star radiates each second. Temperatures are measured in kelvin.

screen-shot-2017-01-21-at-4-20-13-pm

The user is asked to enter in the surface temperature and radius.

To calculate the luminosity I first compared the stars temperature and radius to the Sun’s. Next I used this formula to find the luminosity:

Screen Shot 2017-01-21 at 4.27.38 PM.png

In order to calculate the precise star type I found out what percentile the stars temperature was in the range. I then subtracted this value from 1 to get the opposite value. A0.00 would be the hottest temperature and A9.999 the coolest temperature for A type stars.

screen-shot-2017-01-21-at-4-20-40-pm

screen-shot-2017-01-21-at-4-17-28-pm

Here is a list of the spectral types:

spectraltypes

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s