If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Quiz program in Javascript (Help!!!)

You will use your knowledge of Java programming to create a test program for the seven dwarfs. Let’s pretend that Disney has hired you to make a java program that will test the knowledge of its users. The program will print a positive statement if they are correct and a negative statement if they are wrong.

The program will begin with a print statement that says “Welcome to Disney’s Dwarf Tester”
Then another print statement will follow. It will say” Please pick the correct dwarf: 1. Non-valid dwarf, 2. Valid dwarf, 3. Non-valid dwarf”. (Please use a valid dwarf and two non-valid dwarfs from the list above)
The user will make their choice by entering an integer (1, 2 or 3)
You will create a switch statement to handle the choice selection
When the wrong case is selected then decrement the int variable called counter and print to the console “wrong selection”
When the correct case is selected then change the corresponding boolean variable to true (ie.. firstSelection, secondSelection, etc) and print to the console “Hi Ho, you picked the correct one”
The default case will print a statement to the console “invalid selection”

Repeat this seven times until you covered all seven dwarfs.

At the end, create an if-else statement. This statement will have short circuit &&’s that will test all of the Boolean variables. If true, print a statement to the console “You earned a gold star!”. Else, print a statement to the console “You only got “ +counter + “ correct”. (counter is the variable).