Question : Write the JavaScript code required to complete the program described below (7.5 Marks).
The following program should calculate the total cost for various plane upgrades. This amount must not exceed $3000 to comply with official event regulations. The pilot simply clicks on any upgrades they would like applied to show the cost calculation and the resulting state of compliance (see sample output below).
The checkboxes used to collect input (available upgrades) have "id" values of "propeller-upgrade", "engine-upgrade", "wing-upgrade" and "tail-upgrade" respectively. The
elements used to show output (total cost and compliance) have "id" values of "total-cost" and "compliance-state" respectively.
You are required to program the JavaScript aspect of this software. Your code should be packaged into a single function. You must make use of the correct methods and properties to both calculate and display each result. An "▹" entity reference should also be included at the start of each output string.
The image included above shows how the output is presented when the total cost complies with official event regulations. The image included below shows how the output is presented when the total cost exceeds $3000.
The colour scheme for the "compliance-state"
element is shown within the table below.
Within Budget
Over Budget
#009900
#990000
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here