# Meaning of “==”

Here’s how you get to “==” in Alice. It’s a world function. (and it must be put into an if test)

# Math Expressions in Alice

Alice Supports many types of Math Operations.

For instance, let’s say that we have the variable someNumber  and it has a value of 2

## What if we want to multiply 2  by  0.5 ?

1. click on the down arrow next to “2” and select “math”

2) select “2*”  which means “2 times ”

3) Select “Other” for the second number “b”

4) The calculator appears so you can  choose 5

5)  Select “5”

6) Viola: You know have a math expression that represents 2 * 5

8) Now let’s make a variable called “divisor” and then divide this expression by that

9) Select the down arrow

10) select as shown:

11) Viola :

# Alice 2 : Asking User for Input

The world object has many, many useful functions including a way to ask the user for information—say  a number, a name or something.

1.  Click on world
2.  click on functions
3. scroll down ot the ask user functions (See Diagram 1 ) and read below for more

Diagram 1

Animated Gif showing the whole process of asking user for a number and then saying that number (using what as a String)

# Space Ship Repair Post Mortems

Look at the code below:

Can you see why this student lost credit :

The student did a good job using a function and storing a value in the variable, walkDistance; however, they never then used that variable .

# Space Ship Repairs [Post mortems]

Example 1 :

The code below is almost correct , but the variable walkingDistance  is never used by the move method !

Code Diagram 1 :

Code Diagram 2 :

# Intro to CS [2018-19]

Unit 4 . Parameters and Objects [advanced]

• Complete Packets:
• #18 Writing a Class Level Method
• #20 Saving an Object to a New Class
• #21 Stepwise Refinement (Follow the instructions carefully on this one). If your method does not seem to work, it’s probably because you switched a left leg with a right leg
• #22 Passing Arguments
• Assignments here

Unit 4 . Loops

• Complete Packets:
• 15 b (The Loop Instruction)
• 16 (The While Instruction)
• Assignments here

Unit 3 Datatypes and if/else

Unit 2

• Complete packets #9-10
• #9 (variables)
• #10 functions vs methods
• Drag Racing
• Spaceship Repair
• Apollo 15
• End of Unit Assign

Assignments and Quiz topics

Unit 1

• Complete packets #3- 8  by Thursday Wednesday 27th
• #1 (Example tutorial)
• #2 (skipped)
• #3 Coach–opacity, color
• #4 Camera and manipulating objects (turn,tumble etc)
• #5a Alice code (how to add instructions)
• #5b  Alice Primitive Methods
• #6 ( camelCase,  — read only, no tutorials)
• #7 ( primitive methods from object tree)
• #8 (do together )
• Project #1
• at least 10 instructions
• modify a ‘subpart’
• 1 do-together statement
• at least 3 different objects
• Worth 7 points.
• To get a 7/7 you must achieve the ‘wow factor’–ie go above and beyond to create a superior final project
• you must save your file in the format of
• lastname-assignment1
• morris-assignment1
• Eventual Quiz 1
• binary number systems (see dropbox notes for review)
• converting from various bases to base 10(see Google drive notes for review)
• comment vs instruction in alice

Last year’s

# Web Design Programming 18-19

Supa Web

Unit 4 Bootstrap 4

Unit 3 Jquery

Unit 2 Javascript

Unit

Mr M Assignment (reproduce the screenshots in the powerpoint)

Useful Websites

# Alice Unit 4 [Loops] Assignments

Assignment 4.1)

Centigrade to Fahrenheit Modification: Modify the Fahrenheit to centigrade project as follows.

1. Use a while loop to do as many temperature conversations as  the user wants
2. Ask the user for yes no (help)

Assignment 4.2)

Miles Per Gallon Modification: Modify the miles per gallon project in the same way as the prior exercise.

1. At the start, ask the user how many mpg conversions,  they want to convert.
2. Then use a loop to do that many conversions

Assignment 4.3) Open assignment. Your open project must have each of the following criteria

1. a variable
2. store the return value of a function into that variable
3. a loop of some kind

4.4 Rock Paper Scissors

# Alice Unit 3-4 Assignments

FIRST: make sure you know:  how to use What as a String and perform Math expressions

## Assign 1) Area of Triangle

Reference packets : #11, #12

Create a world that has a character (person/penguin/whatever) that will ask the user for the height of a triangle and the base of a triangle, and  calculate its area

1. 3  different variables  : height , base  and  area  of the triangle
2.  ask the user for  a number  for the height of the triangle and store it into  height (How to ask user for a number)
3.  ask the user for  a number  for the base  of the triangle and store it into  base(ask user for a number)
4.   use area formula and Alice Math expressions to compute the area.  (Note: if you don’t know how to use Math, refer to packet 11 or read this post  )
5. Have your character say the area of the triangle  (remember  area  is a number. You must use what as a string to say it.

## Assign 2) Roman Numeral Translator

Objective : to let the user type in a number between 1 and 10 and then have a character “translate” that into Roman Numerals ( I, II, III, IV, V, VI, VII, VIII, IX, X)

• Ask the user for a number and store the return value into a variable called  numberToTranslate
• use a series of “if/else tests to translate the number and say the appropriate Roman translation for each number between 1 and 10
• Use “==” (link )  to test if two values are the same.
• if the user enters a number greater than 10 then  OR less than 1 , have your character say, use either a or b “Only enter numbers between 1 and 10”

Final result :

We are going to use the roman Numeral Translator file again, so it’s important that you don’t lose the file and give it a good name that you can easily recognize in the future.

Extra credit: Translate 1-20 (Note : You still need to display an error if they enter a number that is too big, which in this case would be >21)

Assignment 3 ) MPG:
Create a world in which the

•  Create 3 variables :  miles, gallons ,MPG
•  2 of the variables  store the return value of a function
• The user is asked for the number of gallons  of fuel his or her car can hold. Use the return value of the ask user for a number function as shown below.
• Do the same thing for the the number of miles  that he or she can drive on a full tank. Use ask a user function to set the value of the miles variable.
• a third variable called MPG .   This one will store the result of some math and will hold the car’s miles-per-gallon (MPG). Calculate the MPG with the following formula

• At the end , your character should say the value of the mpg  . (You must use what as a string )

Lastly,

• use an if/else  as follows
• if mpg is less  than 30, say “wow, what a gas guzzler”
• else say “This car gets pretty good gas mileage”

Assignment  4) Fahrenheit to Centigrade :

• Create a variable called degreesFahrenheit   .
• Store the return value of the ask user for a number function in  degreesFahrenheit
• Create a variable called  degreesCentigrade
• Use the following formula to convert the degreesFahrenheit   to Centigrade using the following formula below:

• use a character from the`People `collection to say the centigrade temperature.
• Don’t forget that you can’t say numbers, you must use what as a string
• use an if/else so that you say “Wow it’s cold” If the final temperature is less than 5 and “Whew it’s hot” if the temperature is greater than 30  (Centigrade)

Assignment 5) Circle’s Area and Circumference: Create a world with your choice of person from the `People`collection. When you play the world, it should

• Ask the user for the radius of a circle. (This value should be stored in a variable ).
• Use a circle shape to represent the circle.
• The person should then say the area and the circumference of the circle.( Links for the circumference formula , area of a circle)
• (For an extra point do the same thing with a “Sphere“. Ask the user for the radius and calculate the surface area and the volume.)  This should be done in the same file as the circle.

Rock Paper Scissors

Assignment 5-extra credit ). Look up the formulas for the volume and surface area of a cylinder . Ask the user for the height of the cylinder and the radius, which should be stored in variables. Then calculate the surface area and volume of the cylinder . See if there is a cylinder shape in the gallery to use as a visual aid. And have an object say the volume and surface areas.

# Nested Loops Projects

## Nested Loop Starter Code

### Method 1) printRectangle()

Change the code from the demonstration of nested loops so that you output the following pattern below. Call this method printSqure()

### Method 2 and 3)

diagAndBrders()                                                    noDiag()

### Method 4)

printMultiplicationTable()