From BU Computer Science
Jump to navigation Jump to search

Sixth Lab, ITSC 121, Spring 2020


Write the following programs. The first one deals with investments. The second deals with taxes. The third deals with strings.

Program 1: Investments

For this program you are to write a method that computes future investment value at a given interest rate for a specified number of years. The future investment is determined using the formula in Programming Exercise 2.21. Use the following header
public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years)
For example: futureInvestnmentValue(10000,0.05/12,5) returns 12833.59.

Write a test program that prompts the user to enter the investment amount (e.g. 1,000) and the interest rate (e.g. 9%) and prints a table that displays future value for the years from 1 to 30, as show below (with the sample input above) :

Years     Future Value
 1            1093.80
 2            1196.41
29           13457.25
30           14730.57 

Quality testing is very important for this program and the rubric will reflect that

Program 2: Taxes

Listing 3.5 gives a program to compute tax. Write a method for computing tax using the following header:
public static double computeTax(int status, double taxableIncome)
Use this method to write a program (that has no input) that prints a tax table for taxable income from $50,000 to $60,000 with intervals of $50 for all the following statuses:

Taxable      Single      Married Joint      Married      Head of
Income                   or Qualifying      Separate     Household
50000         8688       6665                8688        7353
50050         8700       6673                8700        7365
59950        11175       8158               11175        9840
60000        11188       8165               11188        9853

Hint: round the tax into integers using Math.round

Program 3: Strings

write a method that finds the number of occurrences of a specified character in a string using the following header
public static int count(String str, char a)
For example, count("Welcome", 'e') returns 2. Write a test program that does a quality job testing the method. It should not use input. It should call the method enough times to show that it works.The rubric will reflect the importance of testing.


  1. Include proper comments for all
  2. Use proper formatting, etc.
  3. Test with more than one set of data where it is appropriate
  4. Get the correct data outputted on the program before worrying about formatting


  1. Create a software development report that includes the following for the program:
    • A problem summary (the big picture)
    • A list of requirements. (Things that this particular implementation of a solution must do)
    • A list of steps your program does
    • A testing report: What exact input you used and what output you got.
    • How long it took to write it, and how much time was on it each day!
    • Who you got help from (if you got help)
    • Changes (if any) you would make if you had more time and/or skill
    • At least two things you learned while writing the program
  2. Create a zip folder with your software development report(s) and your java file and submit that to canvas.
  3. Due date can be found on canvas