1.1-Introductie-Programmeren

Introduction to Programming - Practice Exam: NightSky

During this practice test, you will build an application that can display data about the stars in our night sky. We maintain several pieces of information about each star. Please note, this program is a simulation and therefore does not correspond to reality.

When the user launches the application, a menu will be displayed. The menu presents the following options and functionality:

If the user selects an option other than those listed in the menu, an error message will be displayed, and the user can make a new attempt.

Please note: The initial number of stars will be 0 (zero). After choosing menu option 1 and successfully importing star data, the number should correspond to the number of stars listed in the CSV file.



Option 1: Read stars from stars.csv

The application will read the file stars.csv and add all the stars mentioned in the file. Ensure that when reading, the first line of the file is skipped. Also, configure the correct CSV separator symbol.



Option 2: Print all stars When this option is selected, the name, distance, and luminosity of all stars will be printed on the screen (refer to the image).


Note: this image is cropped



Option 3: Find the brightest star

When this option is selected, the name of the brightest star is displayed. Brightness can be calculated as follows: luminosity / distance (luminosity divided by the distance). This is the brightness as observed from earth.



Option 4: Show the night sky

Draw all the stars on the screen. Use a circle for each star. Utilize the following data for each star:

Item Rules
X-position on the screen Use the x value from the star.
Y-position on the screen Use the y value from the star
Radius The brightness of the star, the same as in option 3 (This can be calculated using the following formula: luminosity/distance). This value should be an integer.
Color The color is based on the direction of the star. If it’s moving Towards Us (TU):blue, when STill(ST):yellow, and when Moving Away (MA):red.
Name Name of the star. Place it below the star, left-aligned. Use font size 18 and the standard color green.

Applicatie menu

Option 0: Exit

When selecting this option the program should be ended.


Some tips to get started

Good luck