Optional Assignment #8 (AP Computer Science A).
Date assigned: Tuesday, 18 December 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-8. Due date: 18 January 2019
Instructions
Do something creative with the code posted at https://errless.blogspot.com/2018/12/shapes.html or design and implement any other computer program that interests you.When you are finished, turn in a hard copy of your program's output. Email an electronic copy of your source code to Mr. Spurgeon's vcstudent email address.
Assignment #7 (AP Computer Science A).
Date assigned: Tuesday, 18 December 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-7. Due date: 18 January 2019
Instructions
Do as many of the programming exercises posted at https://errless.blogspot.com/2018/12/power-outage.html as you can prior to the due date. You may work alone or in groups of two. Fewer high-quality solutions are better than more low-quality solutions. If you aren’t sure what an exercise is prompting you to do, then ask.When you are finished, one person from each group should email the group’s answers to Mr. Spurgeon’s vcstudent email address. In the body of the email, include the names of the individuals who worked on the assignment if more than one person should get credit for the work.
Assignment #6 (AP Computer Science A).
Date assigned: Monday, 3 December 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-6. Original due date: Monday, 10 December 2018, at the beginning of the class period. Due date: Wednesday, 12 December 2018, at the beginning of the class period. (Extended on Friday, 7 Dec.)
Instructions
Do as many of the programming exercises posted at https://errless.blogspot.com/2018/11/the-josephus-problem.html as you can prior to the due date. You may work alone or in groups of two. Fewer high-quality solutions are better than more low-quality solutions. If you aren’t sure what an exercise is prompting you to do, then ask.When you are finished, one person from each group should email the group’s answers to Mr. Spurgeon’s vcstudent email address. In the body of the email, include the names of the individuals who worked on the assignment if more than one person should get credit for the work.
Assignment #5 (AP Computer Science A).
Date assigned: Wednesday, 7 November 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-5. Due date: Friday, 16 November 2018, at the end of the class period.
Instructions
Do as many of the programming exercises in the following exercise sets as you can prior to the due date. You may work alone or in groups of two. Fewer high-quality solutions are better than more low-quality solutions.- https://errless.blogspot.com/p/programming-exercises.html#even-or-odd
- https://errless.blogspot.com/p/programming-exercises.html#reserved-words
When you are finished, one person from each group should email all of the programs that were completed to your satisfaction to Mr. Spurgeon’s vcstudent email address. Only submit programs that you are very happy with. Programs that are partially complete or do not work or are sloppily done will hurt your grade more than they will help it. Attach each distinct program as a separate .txt file to the single email your group submits. In the body of the email, include the names of the individuals who worked on the programs if more than one person should get credit for the work.
Assignment #4 (AP Computer Science A).
Date assigned: Monday, 15 October 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-4. Original due date: Monday, 22 October 2018, at the end of the class period. Due date (revised on 22 Oct): Tuesday, 22 October 2018, at the end of the class period.
Instructions
Do the programming exercise, including the warm up drills, described at https://errless.blogspot.com/2018/10/programming-exercise-terrific-terrific-terrific.html The Optional Challenge portion of the exercise is optional.
Submit one program that represents your work for drills 3 and 4. Submit a second program that represents your work for The Main Set. In a single email message, each individual contributor or one member from each group should send electronic copies of the programs to be evaluated to Mr. Spurgeon's vcstudent email account; be sure to include the names of all group members in the email message. Print hard copies (one hard copy per group) of the programs and turn them in to Mr. Spurgeon during class on the due date.
For each program you submit, include the names of all people who contributed to the program. Note any significant contributions that individuals made to a program in a comment at the top of the program’s source code. If all members of the group contributed equally to the program, make a note of that fact in the comment. Also briefly describe what the program does in the comment. Above each subroutine in your program, provide a comment that briefly describes what the subroutine does. Explain what the inputs to the program are, what the output of the program is, and what side effects, if any, are produced as a result of executing the program.
Students may work on this assignment individually or in self-selected groups of 2 or 3 students. Students wishing to work in groups should choose one member of their group to send an email to Mr. Spurgeon's vcstudent email address by Wednesday, 17 Oct 2018 (by the end of day), identifying the members of the group.
Assignment #3 (AP Computer Science A).
Date assigned: Monday, 1 October 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-3. Due date: Monday, 8 October 2018, at the end of the class period.
Instructions
Students will work on this project in randomly chosen pairs of two. Cite your sources if you get help from anyone or from anywhere outside of your group of two. Briefly describe the help you received, if you do get help.When you are finished, one of the two students in each group should submit the group’s answers to the exercises below, including your program source code, to Mr. Spurgeon. Email your responses in plain text format (either as a .txt file attachment or in the body of an email message) to jspurgeon@vcstudent.org prior to the due date. Each student should include a copy of the answers their group submits in their journal. Be thorough and concise. Make sure the names of both individuals who worked on the project are included in the email message and on the hard copies. See the course syllabus for information about how you will be penalized for turning in work late.
If there are any instructions that you do not understand, then ask Mr. Spurgeon as soon as possible. If you have put some serious effort into the assignment and are stuck, ask Mr. Spurgeon for help as soon as possible.
Exercises
Study the TOY programs Program C (Compare) and Program M (Mystery), which are posted at https://errless.blogspot.com/p/toy.html.
- What does Program M (Mystery) do? What are the inputs to Program M? What is the output?
- For each of the following decimal (base 10) inputs, describe the output that Program M produces and explain why the program produces that output.
- 65531 65532 65533
- 65536 65535 65534
- 65534 65535 65536
- 65535 65537 65539
- 65537 1 2
- Express the algorithms for Program C and Program M in English in your own words. Do not refer to TOY registers in your descriptions of the algorithms; use variable names instead.
- Create a Java and/or a JavaScript program that includes a function/method equivalent to Program C and a "main" method, equivalent to Program M, that uses the function/method.
- Test the Java or JavaScript program(s) you create using inputs that result in interesting outputs. Describe the inputs you used and the outputs produced.
- Are the programs you wrote in Java or JavaScript functionally equivalent to the TOY programs? In other words, do they always produce the same output for a given set of inputs that the TOY programs produce? If not, what is different about your Java or JavaScript program(s) compared to the TOY ones?
- In Program C, what is the maximum, minimum, and expected (average) number of times INSTRUCTION 11 (A0 + 10) will be called, and what is the (expected) standard deviation? Assume all possible inputs to the program are equally likely. If you're not sure how to figure out the expected values using only math, write a Java or JavaScript program that calls a method equivalent to Program C a very large number of times (e.g. a million) with pseudo-random inputs (use Math.random to generate the inputs), count the number of times the right shift operation is performed each time, and compute the experimental average and standard deviation values. If you think you can compute the average and standard deviation values using only math, explain your reasoning, show your work, and check you answer by performing an experiment using a Java or JavaScript program.
Assignment #2 (AP Computer Science A).
Date assigned: Tuesday, 25 September 2018. Posted at: https://errless.blogspot.com/2018/09/2018-2019-apcsa-assignments.html#assignment-2. Due date: Monday, 1 October 2018, at the beginning of the class period. See also: Evaluation of Students’s Work
Instructions
Students will work on this project in randomly chosen pairs of two. Cite your sources if you get help from anyone or from anywhere outside of your group of two. Briefly describe the help you received, if you do get help.Study the two variations of CircularSeries below.When you are finished, one of the two students in each group should submit the group’s answers to Mr. Spurgeon by emailing them in plain text format (either as a .txt file attachment or in the body of an email message) to jspurgeon@vcstudent.org prior to the due date. Each student should include a copy of the answers their group submits in their journal. Make sure the names of both individuals who worked on the project are included in the email message and on the hard copies. See the course syllabus for information about how you will be penalized for turning in work late.
If there are any instructions that you do not understand, then ask Mr. Spurgeon as soon as possible. If you have put some serious effort into the assignment and are stuck, ask Mr. Spurgeon for help as soon as possible.
- In what ways are the Java and JavaScript programs the same?
- In what ways are the Java and JavaScript programs different?
- What is the purpose of CircularSeries?
- Translate the algorithms associated with each distinct function or method into English. Some methods or functions that appear in both variations are essentially identical; do not translate those methods twice.
- What are some examples of inputs to the main method that produce interesting outputs? Why are the outputs interesting?
- What are some examples of inputs to the main method that produce not-so-interesting outputs? Why are those outputs any less interesting than others?
- What are some examples of different inputs that produce identical outputs?
- How are these programs related to TOY?
- How are these programs related to any computer?
Java CircularSeries
JavaScript CircularSeries
Assignment #1 (AP Computer Science A).
Date assigned: Friday, 14 September 2018. Due date: Friday, 21 September 2018, by the end of the class period. See also: Notes and Assessment of Students’s Work
Instructions
This is an individual assignment. Do your own work, and cite your sources if you get help from anyone or from anywhere. Briefly describe the help you received, if you do get help.Do all of the exercises described in Part 1 and Part 2 below.
When you are finished, submit your answers to Mr. Spurgeon by emailing them in plain text format (either as a .txt file attachment or in the body of an email message) to jspurgeon@vcstudent.org prior to the due date. Include a copy of the answers you submit in your journal: print a hard copy; trim or fold the page or pages so they fit neatly inside; and attach the pages using gluestick. This step must also be completed prior to the due date listed above to avoid late penalties. See the course syllabus for information about how you will be penalized for turning in work late.
If there are any instructions that you do not understand, then ask Mr. Spurgeon as soon as possible. If you have put some serious effort into the assignment and are stuck, ask Mr. Spurgeon for help as soon as possible.
Part 1. Translate each of the following four JavaScript statements into: a) four distinct, corresponding algorithms expressed in English; b) four corresponding programs composed using the Java programming language; and c) four programs composed using the TOY programming language.
/* Program H (Hodgepodge). * by John P. Spurgeon */ // 1. Print the words, 'hello, world'. alert("hello, " + "world\n"); // 2. Output the sum of 4 and 9. alert(4 + 9); // 3. Output the input. alert("output: " + prompt("input:")); // 4. Convert 3 and 10 to hexadecimal; // concatenate the values, and output the result. alert((3).toString(16) + (10).toString(16));
Part 2. a) Translate the following Java program into a JavaScipt program. b) Run the Java program and your JavaScript program ten times each. For each program, record the output and report the minimum and maximum values produced by the program. c) Using the data you collected in b, calculate the average and the standard deviation of your ten trials for each program. Show the details of your calculations.
public class Foo { public static void main(String[] args) { System.out.println(Math.random()); } }