6A

Write a class LoopDeDo. It has several methods that use loops. These problems aren't especially useful, but they will let you practice writing loops.

Provide Javadoc

You will learn later that these methods should be declared static. Don't worry about it now, just put it the back of your mind for a few weeks from now.

For the draft, implement the countUp method

6A draft:
6A final:

6B

A life insurance company needs an application to automate the calculation of yearly life insurance premiums for an individual person. Complete the LifeInsurancePolicy class. The LifeInsurancePolicy class has a constructor that takes a Person object as a parameter (constructor provided). You are also given the Person class.

You must use nested if statements

The cost of life insurance is based on age and gender and whether the person lives in a high crime area. Here is a table of premiums based on age and gender of the person. If the person lives in a high crime area, there is a surcharge of 10%. The company will not insure a person 80 years old or older

  < 21 21 to 60 (exclusive) 60 to 80 (exclusive)
Male $20 per year of life $50 per year of life $110 per year of life
Female $18.50 per year of life $45 per year of life $100 per year of life

For example: The premium for a 30 year old male living in a low crime area would be 30 X 50 and in a high crime area it would be 30 X 50 + (30 X 50) *.1

Implement these methods

Provide Javadoc.

For the draft, implement policyHolderAge, policyHoldeGender, and incrementAge. Provide the Javadoc.

You will need to look at the documentation of the Person class to see how to use the Person class' methods. You can either look at the Javadoc in the source code for the Person class or you can toggle the drop down menu on the right from Source Code to Documentation to get documentation in the familiar Java API format.

shows the location of the drop-down menu on the upper right of a class in BlueJ

Do not have instance variables of age and gender in the LifeInsurancePolicy class.

6B draft
6B final

6C

Complete the TenCircles class to draw ten circles that have radius of 10, 20, ..., 100. They touch the line x = 0 at the left and the line y = 200 at the bottom. (are tangent to the line) Draw the smallest circle first. (updated Mar 12)

Here is an image.

screen shot

You must use a loop in your solution for the final. You will receive no credit for a solution that draws ten separate circles even if it passes Codecheck.

For the draft: just draw the circle with radius 10. No need to use a loop

(updated 3/14/2017)

6C draft:
6C final: