Comp 110L
Lab Project #6
Due: 9/28/2009
1.
Write
a program that prompts the user to enter the number of students and each
student’s name and score, and displays the name and score of the student with
the highest score and the name and score of the student with the second highest
score. (See problem 4.9 on page 134 of the textbook.)
2.
Rewrite
Listing 4.9 on pages 119-120 of the textbook (FindSalesAmount.java) as follows:
·
Use
a for loop instead of a do-while loop.
·
Let
the user enter COMMISSION_SOUGHT instead of fixing it as a constant.
(See problem 4.17 on page 134 of the
textbook.)
3.
Write
a program that displays all the leap years, ten per line, in the twenty-first
century (from 2001 through 2100). (See
problem 4.27 on page 137 of the textbook.)
4.
Revise
Listing 3.5 of the textbook (Lottery.java) to generate a lottery of a two-digit
number where the two digits are distinct.
(Hint: Generate the first
digit and use a loop to continuously generate the second digit until it is
different from the first digit.) (See
problem 4.33 on page 139 of the textbook.)
For
each of the above problems be sure to do the following:
1.
Plan
your solution by writing down the algorithm to solve the problem before you write the code.
2.
Make
sure your programs are self-documented including an appropriate comment header
block.
3.
Test
the programs by running at least three test cases on each.
For
each problem, turn in your algorithm design (this can be a skeleton program
with comments only or a hand written description of the algorithm), a listing
of the program, and a listing of the output from running the test cases.