Welcome to Computer Programming

AppLab Assignments - APPLAB

Section 1

1-1 Change Background

Create an app with 2 buttons.  The buttons when clicked will change the background of the screen red or green. 


  • Do the same thing with one button
  • Have it change to two random colors
  • Have the button color be the next color that the screen will turn
  • Have the button move around screen randomly


1-2 Bigger

Create an app as shown above.  The thumbs up (an image in the library) with the label will be under the bigger number.  The thumb is not shown until the button is pressed.


  • Have a thumbs down next to the lower number
  • If it is a tie, have some image that represents that.
  • Get rid of the button and if the numbers change, the button is shown.



1-3 Simple Calculation (OPTIONAL)

Create an app where there is 2 labels, 1 textfield and a button.  The idea is a user will put their age and you will calculate how many years older I am then you.  For basic version - assume I am older than you (Im 41).


  • Have it allow older or younger people.
  • Have it say one of three jokes (randomly) afterwards (IE, Mr. Borland is older than dirt).
  • Have a slider allow user input.



2-1 Tip Calculator

Notice, the image shown is for advanced, the basic version uses .20 for the tip rate.  Create an app that looks like the left (but basic version does not need tip rate).  The idea is a user will put in their meal price and the app will calculate the tip and total amount.


  • have it be a dropdown for 10%, 15% and 20% tip rates
  • Have it round to the nearest dollar for tip
  • Another option to split the bill, so many ways (ie if there are 4 people, each person puts in ___ ), maybe this appears on another screen


2-2 BMI Calculator (Body Mass Index)

Create a bmi calculator (see here for formula) that will take in height and weight and find the BMI (Body Mass Index).   This is a level of how underweight or overweight someone is.  Here is the table of levels

 Have it say Your BMI is ___, you are normal weight (or overweight or whatever)

Exceeds (do multiple screens and one other of the following):

  • You will have  4 screens.  One for the input, one for underweight, healthy weight, overweight (so if bmi is 25+).  The screens  (video how to do multiple screens) for underweight, healthy weight, overweight will say their BMI and what they should do (eat more, eat less)have sliders and better input than just text inputs

  • have pictures for each
  • Have it round to the nearest dollar for tip
  • Another option to split the bill, so many ways (ie if there are 4 people, each person puts in ___ ), maybe this appears on another screen



3-1 Click Me Game

Create a game where there is a button on the screen that every .5 seconds will move to a new random location.  The object of the game is to see how many times you can hit it.  Your score (how many times you hit it) will appear at the bottom of the screen.  After it moves 10 times, the game is over. 


  • have a high score
  • sounds
  • something else of your choosing



3-2 Car Scene (DO 3-2 or 3-3)

Create an app that has 3 cars that move across as above.  When the car gets to one side, it will reappear back on left side and go again.

  • Find an image of a car online and put three of them in your design
  • For just one, see if you can get the car moving to the right.  See video.
  • Now if its goes of the screen, have it appear again on left side. See video.
  • Now make a function and call that function for each car.  See video.


  • you think of something

3-3 Phone Explosion (DO 3-2 or 3-3) SO THIS IS OPTIONAL

Create a game where it looks like above.  An image of a bomb or something with a text input on it.  There will be a button below.  The idea of the game is the user will have 10 seconds to guess the password.  At the bottom there will be a timer showing how much time left.  Setup the design then:

  • You will need two variables at the top,
    • one called luckyNumber that is a random number (between 1000 and 9999)
    • one called timeLeft that starts at 10.
  • add a timer, so every second, the time left goes down by one and that info is shown at the bottom of the screen ("You have 9 seconds remaining") [video on timer]
  • when they click the button to guess, tell them if they are higher or lower than your lucky neighbor.  If they get it, have it do something special, maybe:
    • have the timer say - You did it (try to make it have the timer turn off)
    • have a new screen that says - You saved your phone - nice
  • If they fail to get it right, the bomb goes off, figure out what that means.



3-4 Function Machine

You are going to create a machine that will take in three inputs and do one of multiple functions on it. The functions you are to create:
  • Minimum - which will take 3 inputs, and return the minimum of those three inputs
  • InOrder - which will take in 3 input and return true (if they are in order from least to greatest, or greatest to least) or return false (if not)
  • Average - which will take in 3 inputs and return their average
  • NumTeens - which will take in 3 inputs and return how many are teens.

The starter code is here.

Exceeds: 4 - Do the quadratic one, where it will output one of the quadratics  .


4-1 Email Account Creator

Create an app that will be used to create a portland schools email account. It will take in the first and last name of the user as shown and then when the button is clicked, create the email account, which is the first five of their last name and the first letter of their first name.  You will need to use .substring (under variables) two times. notes on steps here.

  • For exceeds do two of the following:
    • make all letters lower case
    • if the last name is shorter than 5 characters, take the whole last name and as many letters from first as needed so email is 6 letters long
    • make sure the new account does not have bad words in it (so if the teachers name is Sarah Fatas, it would just show error. (just look for a couple of curses)
    • Make a function createEmail(fname,lname) that will return the email created.

4-2 Random Name Picker

Create an app that will have a list of names (originally with three names). Have the ability to add to the list. Then when they click get random name, it will choose one randomly from the list.


  • each time they put a name in and hit add ->
    • adds to your list (use append)
    • update what shows in the text area (use setText)
  • to get a random name
    • first create a variable maybe called randomIndex that will be random from 0 to length of your list -1 (think about it)
    • then you can get what is there by saying var name = list[randomIndex]
    • now put it in your output spot.
  • Exceeds:
    • have the ability to remove a name from the list, real challenge.
      • You will need to have a new text field taking in a name and a button
      • When that button is pressed
        • you will look through the list (using a for loop (look at basketball!)
          • if the list[i] == the name they put in[getText],
            • remove that index (i)
    • have a new button to find random initials
      • it will get the first letter of each name and put it in the random location (so if names were Hagen,Tannor,Nusra, it would say HTN


4-3 Loop Fun

Create an app (this is starter), that will do these 2 things. First draw 8 dots next to each other. Then in random dots, draw 100 different sized dots all over the screen.

  • Exceeds:
    • do the challenge - the box on the right->that will involve starting from the  center and moving forward  (x amount which will go up each time), then turn right.ap


  • Use our notes for part 1 (red dots)
  • For randomDots:
    • in your for loop
      • create 3 vars (x, and y and radius)
      • set them randomly to values
      • then draw circles


4-4 NBA Player Stats

Create an app (this is starter - YOU WILL NEED THIS DATA in data table nbaPlayers-> video how to start), that will find some interesting stats. All the data in the list is from 2020-2021 season up to 3/23. It lists 500 players with id's 0-499. This is a for loop activity

There are 4 functions to get stats for each player

  • getName(id) -> you give it an id and it will tell you the name of that player
  • getPPG(id) -> you give it an id and it will tell you the points per game (ppg) of that player
  • getTeam(id) -> you give it an id and it will tell you the team of that player
  • getPoints(id) -> you give it an id and it will tell you the total points of that player

You need to do these four events (you will use a for loop going through every id)

  • all points -> if the click this, add up all the points score and have that appear
  • avg of all -> if the click this, find the avg points scored per player in the NBA and have that appear
  • top players -> if the click this, have it spit out the names all players that have scored more than 20 ppg
  • best player points -> if the click this, spit out the name of the player with most ppg (you need to do a for loop)
  • Exceeds:
    • do the celtics and top2
    • another exceeds: create a new button that if they hit top player, it will find the top player on each team! You will probably nered three lists, one for team, one for topPlayer on the team and another for topPPG per team. This is a serious challenge.

Videos that go over this:


5-1 Track Times

Create an app that will allow a runner to track their times. Their times will stay no matter if they turn off the app and restart it. Tutorial is here. Videos are here: video 1, video 2

  • For exceeds try:
    • sorting the times from best to worst (challenging!!!)


5-2 Weather App (starter code)

Create a weather app. So many apps make calls to other websites to get information (like stock quotes, or map information, or music). We are going to use OpenWeather, a website that gives us info about weather forecasts. You will have 2 screens, one that has a pulldown on a number of cities (you choose), and when they select a city, it will return information about the weather in that city.



6-1 Flappy Bird (starter code)

It's game time and what better game to make than the wonderfully addictive flappy bird. Im sure you are familiar with Flappy Bird, but the idea is to keep the bird flying through obstacles (just pipes) that get larger and larger as the game progresses. The bird falls slowly, until you hit the screen, in which case the bird flies up. This is a scrolling game in which the background and pipes move, but the bird stays in the same spot on your screen. The starter code has all the images and basic setup, but no code. That's your job.

  • Create a timedLoop that  every 50ms (or so), it will:
    • Have the background scroll 
      • the backgroundImage is 800 pixels, but only shows 320 at a time.
      • have a function scrollBackground() that will do this
    • Have the bird fall down
      • For the falling down, that will be in the timedLoop
    • Have the pipe scroll
      • Create a function just like moveCar(car) from 3-2 Car Scene that will move the car
      • In the timed loop, call your function
      • Add 2 more pairs of pipes (tops/bottoms)
    • Detect a collision
      • create a function detectCollision that will look to see if the bird has either hit the ground or one of the pipes, see tutorial
      • again from the timed loop, call a new function detect
        • if there is a collision, stop animation, show end screen or message
        • if not, update the score
  • not in timed loop - To move up -you will have to use if the screen was clicked




  • For exceeds:
  • add high score online
  • sounds?
  • other fun stuff.