Name: Date:
The Jack Programming Language
Standard Class Library
- Translate the following Java code into its equivalent Jack code.
Jack Code |
Jack Code |
- Write the Jack code that produces the following transaction with the user.Note: the green text indicates input from the user.
Jack Code |
- Write the Jack code that produces the following transaction with the user.Note: the green text indicates input from the user.
Jack Code |
- Translate the entire Main class (written in Java) into its Jack equivalent.
Jack Code |
- Convert the following Java class (Fraction.java) into its Jack equivalent (two files/classes named Fraction.jack and Main.jack).
Jack Code |
- Write a Jack program that will display a square (30 pixels x 30 pixels), starting in the top-left (x=0, y=0) of the screen, then moving around the edge of the screen clockwise (e.g. along the top edge, then right edge, bottom edge, left edge) until it gets back to the origin.
The square should move by itself, with a short wait between each movement.
Jack Code |
Summative Questions:
- When we execute a Jack program, the first subroutine that starts running is:main()
- Can a subroutine in one Jack class access field variables of another Jack class?
No, unless you create getter methods.
- Which Jack classes should have a method for disposing objects?
All Jack classes should provide this.
- What does the keyword this implicitly refer to? (Select all that apply)
- In constructors: the current object
- In functions: the current object
- In methods: the current object
- In Main.main: the current object
- Which of the following are true about Jack classes? (Select all that apply)
- A Jack class must have a constructor
- A Jack class can contain either methods, or functions, but not both
- Each Jack class must be stored in a separate file
- Each Jack class must have a subroutine named main
Reviews
There are no reviews yet.