Mini-Project:
Math Operations
18
Getting Started
A. Download the Starter Code
B. In AppInventor, click on the Projects drop down menu
select "Import project (.aia) from my computer…"
choose the .aia file you just download and press ok
For each of the following problems, code the solution in the Blocks Editor. Then run and test your solution. Keep running and testing until you are certain that it is correct. Each problem should have its solution displayed in the specific label for it.
Goals & Requirements
0. Rename the Screen1.Title to your name.
1. Compare to 100. Write an app that compares the value input to 100.
It should only display the correct case: equal to, less than, or greater than.
2. Is it odd/even. Write an app that tests whether the value input by the user is odd.
HINT: Look for the modulus/remainder block in the Math drawer. A number is even if it is evenly divisible by 2, or, in other words, if the remainder is 0 when divided by 2
3. Divisible By. A number N is divisible by M if the remainder of N divided by M is 0. All even numbers are divisible by 2. Modify the app to test whether N is divisible by 2, 3, and 5. Some numbers, 30, will be divisible by all three, and some, 17, will be divisible by none.
HINT: To get the output to appear on separate lines:
First set the label to blank
The when you join text, add the label's text first, then the output, then
use the '\n' character in your strings
They need to be separate if's
4. Movie Ticket. Suppose that N represents a person’s age and we want to categorize the person as a youth, adult, or a senior. A senior is a person who is 65 or older. A youth is anyone younger than 18. Display the decision about the person’s category.
5. Ones digit. Display only the ones digit of N.
Hint: Use remainder when dividing by a number.
6. Binary. Display the binary representation of the decimal number entered.
Super Extra Credit: if you calculate the binary without using the convert number block, show TClark your code blocks.
200 → 11001000
256 → 100000000
111 → 1101111
Entire completed app should match the results below.
7. Extra Credit: Style the app nicely. Make the app have a better style. One hint could be to have each test section a different color.
Be creative!
8. Super Duper Extra Credit: Make a function that calculates the greatest common factor of two variables.
Show TClark your completed app, then turn in all the files in the form.