Starting from:

$25+

PL Assignment 3-Implement a simple math quiz Solved


Implement a simple math quiz, whose interface is given below, using JavaScript and HTML.  


The user can choose to do a quiz on integer/float/complex-number addition or subtraction. If the user chooses integer addition, then the program randomly generates two integers X and Y (0< X,Y < 10), and display X+Y on the screen using the prompt dialog box (shown below). You can use Math.floor(Math.random() * 10) to generate a random integer.


After the user provides the answer and clicks OK, an alert dialog box is displayed that shows (1) whether the answer is correct, and if the answer is wrong, then give the correct answer; (2) the total number of questions the user has answered; (3) the number of correct answers; and (4) the number of wrong answers.  Sample outputs are given below.

 

 

 



 

 

 



 

 

If the user chooses float addition, then the program randomly generates two floating points X1.X2 and Y1.Y2, where 0< X1, X2, Y1, Y2 <10, and X1, X2, Y1, and Y2 are integers.  If the user chooses complex number addition, then the program randomly generates two numbers X1+X2i and Y1+Y2i, where 0< X1, X2, Y1, Y2 <10, and X1, X2, Y1, and Y2 are integers.  The sum of the two numbers is (X1+Y1) + (X2+Y2)i.

 

Subtraction is done similarly.

 

The user can also check his or her scores by clicking the “Check Score” button, which shows (1) the total number of questions the user has answered; (2) the number of correct answers; and (3) the number of incorrect answers.  A sample output is given below.  If the user has not answered any questions, then 0 will be displayed in all fields.

 

 

 



 

 

Finally, the user can reset his/her scores by clicking “Reset Score” button, which resets Total, Correct, and Wrong to 0.

 

 

Submission guideline
•       Please hand in your source code electronically.  The file name should be quiz.html.

•       Write a README file (text file, do not submit a .doc file) which contains ▪        The name and email address of group members.

                ▪    (optional) anything special about your submission that the TA should take note of.

•       Place quiz.html and README under one directory with a unique name (such as p3-[userid] for assignment 3, e.g. p3-pyang).  

•       Tar the contents of this directory using the following command. 

tar –cvf [directory_name].tar [directory_name] 

E.g. tar -cvf p3-pyang.tar p3-pyang/   

•       Use mycourses to upload the tared file you created above.

 

Grading guideline
 Readme, correct file names: 4’

 Correctness: 96

 

Academic Honesty:

All students should follow Student Academic Honesty Code

(http://watson.binghamton.edu/acadhonorcode.html). All forms of cheating will be treated with utmost seriousness. You may discuss the problems with other students, however, you must write your OWN codes and solutions. Discussing solutions to the problem is NOT acceptable. Copying an assignment from another student or allowing another student to copy your work may lead to an automatic F for this course.  If you borrow small parts of code/text from Internet, you must acknowledge this in your submission.  Also, you must clearly understand and be able to explain the material.  Copying entire material or large parts of such material from the Internet will be considered academic dishonesty. Moss will be used to detect plagiarism in programming assignments.  You need ensure that your code and documentation are protected and not accessible to other students. Use chmod 700 command to change the permissions of your working directories before you start working on the assignments. If you have any questions about whether an act of collaboration may be treated as academic dishonesty, please consult the instructor before you collaborate.  

More products