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.
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:
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.
Here is a list of the spectral types: