ICS3U Final Projects – Final Deadline: Thurs, June 8 (Last day of Classes)

Each student shall complete at least three (3) of the following projects. Each will be worth 10% of your final mark, with three projects comprising the 30% Culminating Task/Exam portion.

Each project will be marked according to the standard App Marking Rubric. Level 2 Projects will be worth a maximum of 7% of possible 10%, so a Level 2 Project that satisfies all requirements will receive 7%. Level 3 Projects will be worth a maximum of 8% of 10, and Level 4 Projects will be worth the full 10%. Thus, for example, if a student completes two Level 2 Projects and one Level 3 Project, they have an opportunity to receive up to 7% + 7% + 8% = 22% of their 30% Culminating Task mark. The App Marking Rubric marks will be scaled to the appropriate maximums per category (KTAC).

Project submission requirements follow the standard app submission protocols – a printed copy of the code with full documentation, and the .java file (along with any other required files) submitted digitally through e-mail or the Inbox. One resubmission per project without penalty will be accepted if completed before the final deadline.

Notes/Tips:

·  Ensure that all input is validated, ie. the app will not accept an invalid input, like negative numbers if a positive number is specified.

·  Start with your pseudocode, turn it into documentation, then code.

·  Use appropriate methods in all Level 3-4 apps. Your main() method should be as simple as possible and easy to follow, while still containing the main structure and console output of the program. Other methods should not output to the console, unless necessary.

·  Generally, you should have:

o  a method for input including validation

o  other method(s) for calculations and

o  if necessary, a method for output,

so that your main() method illustrates the algorithm flow as simple as possible.

·  Use objects where necessary.

Level 2 Projects

Level 2 Projects do not necessarily have to use methods.

Project 2.1 – Over 9000!

Write an app that repeatedly reads a positive integer, determines if the integer is “weak”, “strong”, or “overpowered”, and outputs the number along with its classification.

A positive integer, n, is said to be “strong” if the sum of its proper divisors equals the number itself. (Proper divisors include 1 but not the number itself.) If this sum is less that n, the number is “weak”, and if the sum is greater than n, the number is “overpowered”.

For each of the following integers, your app should output the classification, as given below. The app should repeat until a 0 (zero) is input, indicating an exit command.

Input number: 4

4 is a weak number.

Input number: 6

6 is a strong number.

Input number: 12

12 is an overpowered number!

Input number: 0

Exiting.

Project 2.2 – A Very Important Date!

Write an app to print out a calendar for a particular month given the day on which the first of the month occurs together with the number of days in the month.

Your app should take as input an integer representing the day of the week on which the month begins (1 for Sunday, 2 for Monday, ... , 7 for Saturday), and an integer which is the number of days in the month ( between 28 and 31 inclusive). Your app should print the appropriate calendar for the month.

Enter starting day (1 = Sunday, 2=Monday, ... 7=Saturday): 3

Enter the number of days in the month: 30

Sun Mon Tue Wed Thr Fri Sat

1 2 3 4 5

6 7 8 9 10 11 12

13 14 15 16 17 18 19

20 21 22 23 24 25 26

27 28 29 30

Project 2.3 – Shelving Books

The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was written correctly. The
1-3-sum of a 13-digit number is calculated by multiplying the digits alternately by 1’s and 3’s (see example) and then adding the results. For example, to compute the 1-3-sum of the number 9780921418948, we calculate

9∗1+7∗3+8∗1+0∗3+9∗1+2∗3+1∗1+4∗3+1∗1+8∗3+9∗1+4∗3+8∗1 to get 120.

The special property of a proper ISBN number is that its 1-3-sum is always a multiple of 10.

Write a program to compute the 1-3-sum of a 13-digit number. Your program should input the ISBN and then print its 1-3-sum. Use a format similar to the samples below. The program should repeat until the word EXIT (ignore caps) is input.

(Hint: Input the ISBN number as a string)

Please input ISBN to check: 9780921418948

The 1-3-sum is 120.

This is a proper ISBN number.

Please input ISBN to check: 9780921418947

The 1-3-sum is 119.

This is not a proper ISBN number.

Please input ISBN to check: eXiT

Goodbye! Please be quiet as you leave the library!

Project 2.4 – Did You Say Drones?

A palindrome is a word that is the same when read forwards as it is when read backwards. For example, mom and anna are two palindromes. A word which has just one letter, such as a, is also a palindrome.

Your app should read a single input word (one word only) and output whether it is a palindrome or not. Ignore the letter cases, i.e. uppercase and lowercase. Repeat the app until the word MOM is input.

Enter the word: Anna

Anna is a palindrome.

Enter the word: bOB

bOB is a palindrome.

Enter the word: exit

exit is not a palindrome.

Enter the word: mom

Run home, little boy!

Project 2.5 – So You Think You Can Sing?

A vote is held after two singers (A or B) compete in the final round of a singing competition. Your job is to count the votes and determine the outcome.

The first two lines of input will be the singers’ names. The third line of input will contain the total number of votes, up to 15. The last line of input will be a sequence of characters, each of which will be A or B, representing the votes for a particular singer. If any character other than A or B is input, or the number of votes doesn’t match the third line input, then the program should request the votes again.

The program should output whether singer A or B received more votes, or if there was a tie.

Name of Singer A: Kanye West

Name of Singer B: Goat

Kanye West vs. Goat!!

Number of votes: 20

That is too many votes!

Number of votes: 9

Enter votes: ABBBAACAA

Invalid voting input.

Enter votes: BAABBAA

Number of votes does not match.

Enter votes: ABBBAABBA

Goat won! Congratulations, Goat is a better singer than Kanye West!

Level 3 Projects

Level 3 Projects should use methods for full marks.

Project 3.1 – He Said What?!

The Society for Words Every Adult Reviles has observed a growing number of chat lines on the Internet. A chat line allows a user to type lines of text that are transmitted to all other users. The Society is concerned about the number of four-letter words being transmitted by these chat lines and has proposed the mandatory use of software to remove all four-letter words from every transmission. Your job is to write the software to do this removal.

Each line of text contains words separated by spaces. The output from your app should consist of the modified text, with each four-letter word replaced by four asterisks. Repeat the app until the word EXIT is input (ignore caps).

Note: You may not use the String.replaceAll() function.

The quick brown fox jumps over the lazy dog

The quick brown fox jumps **** the **** dog

Now is the time for all good people to come to the aid of the party

Now is the **** for all **** people to **** to the aid of the party

EXiT

Exiting.

Project 3.2 – AmeriCanadian

Americans spell differently from Canadians. Americans write "neighbor" and "color" while Canadians write "neighbour" and "colour”. Write an app to help Americans translate to Canadian.

The user should type a word and if the word appears to use American spelling, the app should echo the Canadian spelling for the same word. If the word does not appear to use American spelling, it should be output without change. When the user types EXIT (ignore caps) the app should terminate.

The rules for detecting American spelling are quite simple: If the word has more than four letters and has a suffix consisting of a consonant followed by "or", you may assume it is an American spelling, and that the equivalent Canadian spelling replaces the "or" by "our". Note : you should treat the letter "y" as a vowel.

Enter words to be translated:

color

colour

floor

floor

Taylor

Taylour

EXit

Exiting.

Project 3.3 – The Great Divide

Many advanced calculators have a fraction feature that will simplify fractions for you.

You are to write an app that will accept for input a non-negative integer (³ 0) as a numerator and a positive integer (>0) as a denominator, and output the fraction in simplest form. That is, the fraction cannot be reduced any further, and the numerator will be less than the denominator. The app does not have to repeat.

Input Numerator: 28

Input Denominator: 7

The simplified fraction is 4

Input Numerator: 13

Input Denominator: 0

Input Denominator: 5

The simplified fraction is 2 3/5

Input Numerator: 0

Input Denominator: -7

Input Denominator: 6

The simplified fraction is 0

Input Numerator: -55

Input Numerator: 55

Input Denominator: 10

The simplified fraction is 5 1/2

Project 3.4 – Ocean’s Elevens

Write a program which accepts as input a positive integer and checks, using the algorithm described below, to see whether or not the integer is divisible by 11. This particular test for divisibility by 11 was given in 1897 by Charles L. Dodgson (Lewis Carroll).

Algorithm:

As long as the number being tested has more than two digits, form a new number by:

- deleting the units digit

- subtracting the deleted digit from the shortened number

The remaining number is divisible by 11 if and only if the original number is divisible by 11. You may not use the modulo operator % to determine the divisibility of this two-digit number either.

Note: Leading zeroes are not considered part of the number and should not be printed.

The output consists of a series of numbers formed as a digit is deleted and subtracted, followed by a message indicating whether or not the original number is divisible by 11. The app should accept positive whole numbers up to 12-digits long (as shown below).

What number would you like to check for 11-divisibility?

123456789005

123456789005

12345678895

1234567884

123456784

12345674

1234563

123453

12342

1232

121

11

The number 123456789005 is divisible by 11.

Project 3.5 – Counting Fours

When a credit card number is sent through the Internet it must be protected so that other people cannot see it. Many web browsers use an encryption method based on RSA numbers. A number is an RSA number if it has exactly four divisors. In other words, there are exactly four numbers that divide into it evenly.

For example, 10 is an RSA number because it has exactly four divisors (1, 2, 5, 10). 12 is not an RSA number because it has too many divisors (1, 2, 3, 4, 6, 12). 11 is not an RSA number either. Therefore, there is only one RSA number in the range 10...12.

Write a program that inputs a range of integers and then counts how many integers within that range (including the numbers input) are RSA numbers.

Enter lower limit of range: 10

Enter upper limit of range: 12

The number of RSA numbers between 10 and 12 is 1

Enter lower limit of range: 11

Enter upper limit of range: 15

The number of RSA numbers between 11 and 15 is 2

Level 4 Projects

Level 4 Projects must use methods for full marks.

Project 4.1 – Anagrammatical (Counts as 1 app, or 10%)

An anagram is a word or a phrase formed by rearranging the letters of another phrase such as “ITEM” and “TIME”. Anagrams may be several words long such as “TOM MARVOLO RIDDLE” and “I AM LORD VOLDEMORT”. Note that two phrases may be anagrams of each other even if each phrase has a different number of words (as in the previous example). Write an app to determine if two phrases are anagrams of each other.

The app should prompt the user for two phrases, each entered on a separate line. You may assume that the input only contains lower case letters, upper case letters and spaces. The app should output whether the phrases are anagrams or not.

Enter the first phrase: Tom Marvolo Riddle

Enter the second phrase: I am Lord Voldemort

Tom Marvolo Riddle is an anagram of I am Lord Voldemort!

Project 4.2 – Deal or No Deal (Counts as 2 apps, or 20%)

“Deal or No Deal” (TM) is a game show on NBC. (You can play it at http://www.nbc.com/Deal_or_No_Deal/game/flash.shtml)

In this version of the game, there are 10 possible dollar amounts: $100, $500, $1 000, $5 000, $10 000, $25 000, $50 000, $100 000, $500 000, $1 000 000 sealed in imaginary briefcases. These dollar amounts are numbered 1 – 10 (i.e. 1 à $100, 2 à $500, 3 à $1 000, ..., 10 à 1 000 000). Before the game starts the contestant will have chosen one of the briefcases as his/hers to possibly keep. During the game, some of the ten possible dollar amounts have been eliminated from the game because the contestant has selected some of the other briefcases and revealed the amounts inside.

At some point, the contestant will stop opening briefcases, and a “Banker” will offer the contestant cash in exchange for what might be contained in his/her chosen briefcase. Then the contestant is asked: “Deal or No Deal?”