Project 4
Part A Due 21:00 Fri, 5/23
Part B Due 21:00 Fri, 5/30


Project 4 Requirements


  1. Read The Discipline of Programming. Read an important information if you are working with a partner.

  2. Part A. Due 21:00 Fri, 5/23.

    Create these web applications by completing these steps in the order shown: completely solve the first step before going on to the second, etc.

    1. Save theoryMachine.html as /111/p4/theoryMachine.html.

      Enable the isPrime button by A) writing an isPrime() function, and , B) modifying the rbDispatch() function.

      As usual, the function definition goes in a script in the head section. Test it and debug as necessary.

      When it is correct upload theoryMachine.html to /111/p4/theoryMachine.html on the server.

      Note: you will solve this exercise in your week 8 lab.

    2. The Proper divisors of a number n are all the divisors of n, excluding n itself. E.g., 1, 2, and 3 are the proper divisors of 6.

      Write a function named listProperDivisors(n) that accepts a positive integer n and returns a string containing the list of the proper divisors of n.

      When it is correct upload theoryMachine.html to /111/p4/theoryMachine.html on the server.


  3. Part B. Due 21:00 Fri, 5/30.

    Create this web application by completing these steps in the order shown: completely solve the first step before going on to the second, etc.

    1. For background information, read Dr. Math's description of the the Russion Peasant Algorithm to multiply two numbers.

    2. Write a JavaScript function multRPA(m,n) that accepts two positive integers and returns their product.

      Your task: translate the logic shown in the the Pseudocode Russian Peasant Algorithm into a JavaScript function that can be used in the theoryMachine.

    3. Add a multRPA radio button to theoryMachine.html. When the button is selected and Apply Function is clicked, the number entered into the form by the user is squared by multRPA().

    When it is correct, upload theoryMachine.html to /111/p4/theoryMachine.html.

    Note: since you already will have submitted Project 4-A in Blackboard, you do not have to re-submit this part of the project in Blackboard.

  4. Extra Credit (3 XC points): Use a 2-D array to build a 2-D table of N powers of N.

    Write a function NpowersN() that accepts a natural number n and returns a string representing a table of N powers of N. The following examples show the value returned by the function for n = 4, n = 5, and n = 6:

        

    Guidelines & Constraints:

    NpowersN() must use a local 2-D array to hold the table values. After buidling the table, traverse it to generate the string used to output the table; the function returns the output string as its value. The function does not prompt the user for n: that duty is handled outside the function, and n is passed to NpowersN() as an argument.

    Study the 2-D Array example we covered in class.

    Remember that escape sequences (such as \n and \t) can be used in JavaScript strings to control formatting.

    To receive XC points: Since you already submitted P4 in Blackboard, please send your GTF email stating "Extra Credit Option Completed" in the Subject section. Thanks.

    Read Policy on Extra Credit.


  5. Project 4 Grading Rubric. This document describes in detail how your lab instructor (GTF) will grade your project. To get full credit for your work, evaluate your project carefully using the rubric before submitting it for grading.

  6. How to Submit Project 4 for Grading in Blackboard.

    On or before the Part-A due-date submit the project using Projects > Submit Project 3 in Blackboard. You must include your htaccess-enabled project URL in the Comments section.
    If you do not use this BB assignment turn-in feature, your project cannot be graded and your score will be zero (0).

    Project 4 is in two parts, but you only have to submit it once in Blackboard, when you complete part A. You do not have to re-submit in Blackboard for part B-- just upload guessMyNumber.html to the server by the due-date for part B and you're done-- no second BB submit is required. No email is required. Done.


Pair Programming Teams

You may work alone on the projects or with one partner, in a programmer team. Groups of three or more are not an option.

If you work as a team:

A. IMPORTANT information if you are working with a partner: You must notify the grader of both programmer names in the Comments section when submitting the project in Blackboard. Failure to do this may trigger an investigation of academic dishonesty.

B. Each partner must maintain copies of all project files, etc., in his or her 111 site on uroegon.edu

C. You must each understand the solution you are turning in. Exams will cover much of the same material as the lab exercises, so both partners on a team should understand the material.