Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 6: Write the JavaScript code required to complete the program described below (7.5 Marks). The following program should calculate the amount of additive (in

image text in transcribedimage text in transcribed

Question 6: Write the JavaScript code required to complete the program described below (7.5 Marks). The following program should calculate the amount of additive (in millilitres) that must be mixed with water for 3 different aquarium products. The user simply enters a number to perform these calculations and display all results accordingly. Aquarium Additives Calculator Enter the amount of water in litres: This aquarium requires 34 millilitres of 'Quick Start' additive. This aquarium requires 17 millilitres of 'Stress Coat' additive. This aquarium requires 17 millilitres of 'Stress Zyme' additive. The textbox used to collect input (water in litres) has an "id" value of "water-amount". The p > elements used to show each result (additive in millilitres) have "id" values of "quick-start", "stress-coat" and "stress-zyme" respectively You are required to program the JavaScript aspect of this software. Your code should be packaged into a single function. You must use the correct methods and properties to calculate and display the results. An "\▹" HTML entity should be included at the start of each output string. Note that all results must be rounded to the nearest integer. The formulas for calculating each amount are as follows: The user's input must be validated as a number between 5 and 200 inclusive. A Javascript alert should be shown if the value does not conform to this range. The content of the alert must match the image shown below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions