Here’s how you get to “==” in Alice. It’s a world function. (and it must be put into an if test)
Author Archives: Mr. M
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 ?
- 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.
- Click on world
- click on functions
- scroll down ot the ask user functions (See Diagram 1 ) and read below for more
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
Space Ship Repairs [Post mortems]
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
- Complete packets
- #10
- #11 (math Expressions)
- #12 (Strings and Text)
- Read: Important post to understand
- Area of Triangle Assignment (only that one assignment)
- #13 (booleans)
- #14 (relational operators) (Show me this one when you’re done with the gumdrop/fish tutorial)
- Complete the rest of unit 3/4 assignments
Unit 2
- Complete packets #9-10
- #9 (variables)
- #10 functions vs methods
- Drag Racing
- Spaceship Repair
- Apollo 15
- End of Unit Assign
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
Web Design Programming 18-19
Supa Web
Phaser.io resources and links
Unit 4 Bootstrap 4
- Class PPT’s on bs4
- Bootstrap 4 documentation
- Bootstrap 4 @ www
- Download the bs4 (unzip this then copy contents of the “dist” folder to a “bs4/” folder in your project (https://getbootstrap.com/docs/4.1/getting-started/contents/#css-files)
- cdn paths : https://www.bootstrapcdn.com
-
12<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
-
- Colors (bg-danger, text-success etc..)
Unit 3 Jquery
Unit 2 Javascript
- Date Object ( https://www.w3schools.com/jsref/jsref_obj_date.asp)
Unit 1
Mr M Assignment (reproduce the screenshots in the powerpoint)
- how to link external css file ( download example ) or read this
- Horizontal HTML List
- Positioning Elements (fixed, absolute)
- Mr M’s font : font-family: “Open Sans”, Helvetica, Arial, sans-serif;
Useful Links
- HTML & Css
- Javascript
- expression vs function (advanced)
- Server Stuff
- Header Checker (enter URL to see list of headers sent to browser)
Useful Websites
- CSS
- https://css-tricks.com
- https://www.w3schools.com
- Bootstrap 4
- Hidden/visible
- Centering Content
- bs4 Utilities (nice summary by w3schools)
- 07 Planning
- Javascript
Alice Unit 4 [Loops] Assignments
Assignment 4.1)
Centigrade to Fahrenheit Modification: Modify the Fahrenheit to centigrade project as follows.
- Use a while loop to do as many temperature conversations as the user wants
- 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.
- At the start, ask the user how many mpg conversions, they want to convert.
- Then use a loop to do that many conversions
4.25 ) Guess Animal’s weight assignment
Assignment 4.3) Open assignment. Your open project must have each of the following criteria
- a variable
- store the return value of a function into that variable
- a loop of some kind
Alice Unit 3-4 Assignments
FIRST: make sure you know: how to use What as a String and perform Math expressions . You will not be able to do this assignment until you understand both of the above lessons.
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
- 3 different variables : height , base and area of the triangle
- ask the user for a number for the height of the triangle and store it into height (How to ask user for a number)
- ask the user for a number for the base of the triangle and store it into base(ask user for a number)
- 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 )
- Read this article if you have not already. ( You cannot do step 6 until you have read it)
- 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)
Assign 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.
- 2 of the variables store the return value of a function
- 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
1 |
MPG = miles/gallons |
- 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”
Assign 4) MPG Temp Converter with if/else
- 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:
1degreesCentigrade = (5/9) * (degreesFahrenheit − 32)
- 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
1 2 3 4 5 6 7 8 9 10 11 12 |
void nestedLoopDemo(){ for (int row = 1 ; row <= 4 ; row++) { System.out.print("row "+ row + " : ") ; for (int star = 1 ; star <= row ; star++) { System.out.print("* ") ; } System.out.println() ; } } |
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()