6A

In this problem, you will write a class FinanialAidApplicant which will help a financial aid officer determine if the applicant qualifies for financial aid. Here are some made-up rules telling who qualifies for aid.

Qualification is based on annual household income and the number of people in the household. If the household income is less than or equal to $60,000 and there are 4 or more people in the household, the applicant qualifies. If the household income is more than $60,000 but less than or equal to $150,000 and there are 6 or more people in the household, the applicant qualifies. If the household income is less than $25,000, the applicant automatically qualifies regardless of how few people are in the household. If the household income is greater than $150,000, the applicant does not qualify no matter how many people are in the household.

FinanialAidApplicant has a constructor that takes a double and an int as parameters

(Note the misspelling of Financial. You will need to misspell it also for Codecheck to work)

It also has methods:

Provide Javadoc

Use nested ifs. There are other ways to do this but I want you to use nested ifs

No starter class this time.

For the draft, provide the instance variables, the constructor, and implement the setNumberOfPeopleInHouseholdand getNumberOfPeopleInHousehold()methods. Implement setHouseholdIncome and qualifies as a stub. Note that a stub with return type boolean returns false. Provide the Javadoc. The Javadoc should document the code that will be in the final not the draft.

6A draft:
6A final:

6B

Implement a class Looper which contains several methods to work with loops.

public int sumOfPowersOfTwo(int value) Return the sum of all the non-negative integer powers of two less than the given value. Use a loop in the final. (For the draft you will not need a loop).

Do input validation. If value is less to 2, there is no answer so handle those situations by returning 0.

If value = 16, you would return 15 because

20 + 21 + 22 + 23 = 1 + 2 + 4 + 8 = 15

and 24 = 16 which is not less than 16.

public String everyOtherLetter(String phrase) gets a string consisting of every other character starting with the character at at index0

public double oddAverage(int count) Asks the user for count integers and returns the average of the odd integers. If count is 5, you will prompt the user 5 times to enter a number. Take the sum of those that are odd and then find the average.

Use prompts that look like these in the loop:

Enter integer 1:
Enter integer 2:
...
Enter integer 5:

If count is <= 0, return 0. (We do not want to divide by 0)

The output might look something like this is, if count is 5

Enter integer 1: 25
Enter integer 2: 4
Enter integer 3: 1
Enter integer 4: 3
Enter integer 5: -7
5.50

Notice the inputs could be negative.

No starter. No Javadoc

For the draft, implement the sumOfPowersOfTwo method to return the sum of the powers with a value less than 25. Do not use a loop for this. Just add the values in the code. but think about how you determine when to stop. You will remove this code in the final and use a loop instead. Do not just print the literal 31


6B draft:
6B final:

6C

Implement the following methods for BeginningsAndEndings class.

A constructor that takes a single String parameter has been implemented for you.

The words will be separated by spaces, and you can assume the phase is well-behaved

A method called beginningLetters that returns a string consisting of the first character of every word in the string. If the string is the empty string return the empty String

A method called endingLetters that returns a string consisting of the last letter of every word in the string. The trickiest part here is that if the last character before a space is not a letter (it might be a , or a ?), you need to get the character before that. (That will have to be a letter since we disallow a pattern like "12, " But a pattern like "cat, " would be valid and you want to get the "t") If the string is the empty string return the empty String

There is a helper method isLetter included in the starter class which takes a string of one character and returns true if the character is a letter otherwise it returns false. Don't worry that the method has a modifier of static. We will cover static later. Right now just call the method with a String argument of one character.

Include Javadoc for the every public class, method and constructor.

For the draft, implement beginnignLetters to return the first letter of the first word. Implement endingLetters() as a stub. Include Javadoc for both methods.

6C draft:
6C final: