PROGRAMMING ASSIGNMENT 1--- DUE Thursday, February 14th
Use iteration structures (loops) to modify the program
Guessing.Java given in the note set 4. Your program should
repeatedly ask the user to guess a number between 1 to 10 or to input
the number -1 when he wants to terminate the program. If the number given
by the user is not equal to -1, or if the number given as a guess is
outside the range 1 to 10, your program should prompt the user that
an illegal guess was given and he should please reenter his guess.
At termination, your program should print out the percentage of correct
guesses, and if that percentage is over 50 percent should print "great
job", but if the percentage is 50 percent or less it should print "ur not
having a good day guessing".
_______________________________________________________________
PROGRAMMING ASSIGNMENT 2--- DUE Tuesday, February 26th
(modification of the quiz program from powerpoint notes set 6,
slide 50)
Write a program that creates a pool of quiz questions with corresponding
correct answers. The pool should contain three questions of progressive
difficulty from complexity 1(easier) to 4 (hardest) for a total of 12
questions. Your driver program should ask the user if "you want to take a
quiz? (yes or no)" repeatedly until he user inputs "no" whence it
terminates. If the user inputs "yes", the program should randomly generate
four questions from the pool to ask him, but at least one of complexity 4.
Capitalization of the input yes/no should not matter. After user answers
the questions, the program should print the score for the quiz (how many
out of the four questions were correctly answered). Capitalization in the
users answers should not matter when they are matched with the correct
answers. A complexity interface should be used as in the quiz example of
powerpoint notes set 6.
_________________________________________________
PROGRAMMING ASSIGNMENT 3--- DUE Thursday, March 6 th
(modification of assignment 2, using arrays of objects, similar to
CDcollection example)
Create a class "QuestionPool" with instance variables:
an array of "question" objects, private question[ ] pool;
and an integer to keep track of the number of questions
stored in the array, private int count;
A member method "addQuestion" should be written to add a new question
object in the pool, similar to the "addCD" method in the CDcollection
example in powerpoint notes on Chapter 7-Arrays. The constructor of no
arguments should create a "QuestionPool" with the array "pool" having a
length of 10. As in the CDcollection example, a method "increaseSize( )"
should also be implemented to adjust the array length if necessary by
doubling it.
In the driver class, first an object should be created in the
"QuestionPool" class by repeatedly asking the user for
question/answer/complexity_of_question inputs which are then put in the
array by the addQuestion method. Once the pool is created, the program
should proceed as in assignment 2, asking the user if he/she wants to
take a quiz, and if so, 4 questions should be picked randomly and posed
to the user, and number answered correctly should be displayed as in
exercise 2.
For example:
Would you like to add a question to the pool?(Y/N)
Y
input the question:
Who is the president of the USA?
input the answer:
Bush
input complexity of this question(1 to 4):
1
Would you like to add a question to the pool?(Y/N)
Y
input the question:
Who is the vice president of the USA?
input the answer:
Chenney
input complexity of this question(1 to 4):
2
Would you like to add a question to the pool?(Y/N)
Y
input the question:
Which is the capital of Illinois?
input the answer:
springfield
input complexity of this question(1 to 4):
4
Would you like to add a question to the pool?(Y/N)
Y
input the question:
Which is the biggest city in Illinois?
input the answer:
chicago
input complexity of this question(1 to 4):
1
Would you like to add a question to the pool?(Y/N)
N
Thank you, I created the pool
would you like to take a quiz?(Y/N)
Y
etc. as in assignment 2.
______________________________________________________________
PROGRAMMING ASSIGNMENT 4
DUE: Thursday, April 3rd
Create a web page on your hilltop account and attach the following
applets:
from chapter 2: Snowman.java
from chapter 3: Authority.java, NestedPanels.java and LabelDemo.java
How to submit: when done email to me a message and give me the URL
of your home page.
_________________________________________________________________
PROGRAMMING ASSIGNMENT 5--- DUE Thursday, April 17 th
(modification of assignment 3, but using stacks instead of arrays of
objects)
Create a class "QuestionPool" with instance variables:
a stack of "question" objects, named "pool";
The stack method "pushQuestion" should be written to add a new question
object in the pool, similar to the "addCD" method in the CDcollection
example in powerpoint notes on Chapter 7-Arrays. The constructor of no
arguments should create a "QuestionPool" with the stack "pool" having a
capacity to hold 10 items. As in the CDcollection example, a method
"increaseStackSize( )"
should also be implemented to adjust the stack size if necessary by
doubling it.
In the driver class, first an object should be created in the
"QuestionPool" class by repeatedly asking the user for
question/answer/complexity_of_question inputs which are then put in the
array by the pushQuestion method. Once the pool is created, the program
should proceed as in assignment 2, asking the user if he/she wants to
take a quiz, and if so, the top 4 questions contained in the stack should
be posed to the user, and the number answered correctly should be
displayed as in exercise 2.
For example:
Would you like to add or delete a question from the pool or
show questions?(A/D/N/S)
A
input the question:
Who is the president of the USA?
input the answer:
Bush
input complexity of this question(1 to 4):
1
Would you like to add or delete a question from the pool or show
questions?(A/D/N/S)
A
input the question:
Who is the vice president of the USA?
input the answer:
Chenney
input complexity of this question(1 to 4):
2
Would you like to add or delete a question from the pool or
show questions?(A/D/N/S)
A
input the question:
Which is the capital of Illinois?
input the answer:
springfield
input complexity of this question(1 to 4):
4
Would you like to add or delete a question from the pool or
show questions?(A/D/N/S)
A
input the question:
Which is the biggest city in Illinois?
input the answer:
chicago
input complexity of this question(1 to 4):
1
Would you like to add or delete a question from the pool or show
questions?(A/D/N/S)
D
Ok, the top question was deleted.
Would you like to add or delete a question from the pool or show
questions?(A/D/N/S)
S
(should list the questions only, not the answers or complexities)
Would you like to add or delete a question from the pool or show
questions?(A/D/N/S)
N
Thank you, I created the pool
would you like to take a quiz?(Y/N)
Y
etc. as in assignment 2.
______________________________________________________________
PROGRAMMING ASSIGNMENT 6--- DUE Tuesday, May 6 th
(modification of assignment 2,3,5, but using linked lists with pointers
instead of arrays and using insertion sort)
Repeat assignment 5, but this time use the "SortedList" data structure
from the Chapter 5 notes to implement the QuestionPool (the question
objects in the linked list QuestionPool should be kept in ascending order
by complexity type). When the 4 questions of the quiz are generated, the
first question of each complexity type should be included in the quiz.
(add a member method to "SortedList" class,
public question retrieve(int complexityIndex),
which will return the first question with given complexity from the
QuestionPool list)
____________________________________________________