Array Practice
GPA from Array Use the following arrays
var Grade = new Array("A","A-","B+","B","B-","C+","C","C-","D+","D","F");
var Weight = new Array(4,3.667,3.333,3,2.667,2.333,2,1.667,1.333,1,0);
to populate a drop-down select with possible grades in code. Have another drop-down
select that allows the user to select the number of credits (3 or 4). The user then
uses these drop-down selects and the text input to make a list of courses and to keep
a running total the number of credits as well as the number of credits times the
grade weigtht. The GPA is then the second total divided by the first. Use the array
and jQuery.inArray to allow you to associate the grade (A-) and grade weight (3.667).
Die frequencies Write a script that allows the user to enter the number of times
to simulate the rolling of a die. Use an array to track the frequency of each die value --
that is the number of times in was rolled. Display the die frequencies along with the
corresponding percentages.
Trivia Quiz Use the arrays below to display one question at a time for the trivia quiz.
Also use split() to break the answer string into indvidual answers and display those next to
some corresponding radio button. (Supposedly the first answer is correct). Keep track of how many
answers the user got correct. Know when the quiz ends and stop the user from continuing.
Shuffle the questions and choices (so they stay together). Shuffle the individual answers.
var Question = new Array("What do the Danish call Danish pastries:", "The German word kummerspeck, meaning weight gained through comfort eating, literally means what:", "A swede is:", "Which of these was once the national drink of Scotland?", "Which of the following was a predecessor of the Milky Way bar:", "According to the International Cloud Atlas, which of these is the highest?", "Which is the deepest loch in Scotland:", "What was the first of Earth's supercontinents:", "In which country was the Can-Can invented:", "The word absinthe comes from the Greek apsinthion, meaning what:");
var Choices = new Array("Viennese Bread|Alsatian cakes|Danishpastries", "Grief bacon|Cream guzzling|Disappointment candy", "A cross between a cabbage and a turnip|A cross between a parsnip and a beetroot| A cross between fennel and carrots", "Claret|Amaretto|Vodka", "Fat Emma|Lardy Larry|Penny Plump", "Cloud zero|Cloud nine|Fog", "Loch Morar|Loch Lomand|Loch Ness", "Rodinia|Pangaea|Gondwanaland", "France|UK|Canada", "Undrinkable|Green Monster|Vomiting");