Site Navigation

Site Search

CS 110: Lab 10

Learning Objectives

After completion of this lab, you should be able to

Work collaboratively as a pair programming team

All labs in CS 110 will be done as pair programming teams. Your partner for today's lab is listed in the table below:

Hebeler 203
Grader: Vinh Tran; Assistant: Daniel Carpenter
Team 1
Aguilar Jr, Jaime
Nash, Chris
Team 2
Amezcua Gutierrez, Edson
Olivares, Scott
Team 3
Baird, Owen
Shearer, Stetson
Team 4
Berman, Jake
Wagster, Nathan
Team 5
Coudriet, Blake
Smith, Stephanie
Team 6
Erickson, Joel
Awan, Samara
Team 7
Goeke, Max
Bloom, Thomas
Team 8
Harris, Alexander
Olden, Greg
Team 9
Heflick, Liz
Cuddington, Chris
Team 10
McCauley, Rylee
Straub-Walden, Andy
Team 11
Millard, Ryan
Williamson, Sarah
Team 12
Barrett Wright, Matthew
Hastings, Jake
Team 13
Millard, Mike
Quayle, Weston
Team 14
Field, Sarah
Hogan, Martin
Team 15
Akana, Chris
Ling, Nathan
Fill in: Hansen, Mitchell

Note: Partners will change every week.

You may wish to review basic pair programming guidelines before you begin.

You should change roles every 10 to 15 minutes.

Use test-driven development for developing software programs

Lab 10 is based on Chapter 5, Programming Challenge #4 of your textbook.

Write a program that calculates how much a person would earn over a period of time if his or her yearly salary begins at $1,000.00 the first year, $2,000.00 the second year, and continues to double each year.

Test your understanding by completing the test case table for the salary earned in years 5-10

Test Case Table
Year NumberSalary

Write your calculated test case values in the Lab 10 assignment sheet. You will turn in this sheet credit.

Create the Java class

  1. Design and implement the Java class that has a main method that prompts the user for number of years they plan to work and then displays a table showing the salary for each year.
    • Lab 10 will use only one Java file containing a main method (not two)
How many years will you work? 6

Year       Salary Earned
1          $1,000.00
2          $2,000.00
3          $4,000.00
4          $8,000.00
5          $16,000.00
6          $32,000.00

Tip: Use one simple count-controlled while loop and calculate and display the year and salary earned inside the body of the loop.

Calculate a running total

  1. Add a running total to your program to keep track of their total pay received over the years
  2. Display the total pay and average salary received
    • Test your program with several different values for number of years worked
How many years will you work? 7

Year       Salary Earned
1          $1,000.00
2          $2,000.00
3          $4,000.00
4          $8,000.00
5          $16,000.00
6          $32,000.00
7          $64,000.00

Total pay: $127,000.00
Average salary: $18,142.86


To Receive Credit

You are allowed to drop your lowest lab grade.