CS220 Lab#9 -High Level Language Solved

30.00 $

Category:

Description

Rate this product

Name:                                                 Date:                                              

The Jack Programming Language

Standard Class Library

 

  1. Translate the following Java code into its equivalent Jack code.
Jack Code
 

 

Jack Code
 
  1. Write the Jack code that produces the following transaction with the user.
    Note: the green text indicates input from the user.
Jack Code
 
  1. Write the Jack code that produces the following transaction with the user.
    Note: the green text indicates input from the user.
Jack Code
 
  1. Translate the entire Main class (written in Java) into its Jack equivalent.
Jack Code
 
  1. Convert the following Java class (Fraction.java) into its Jack equivalent (two files/classes named Fraction.jack and Main.jack).
Jack Code
 

 

  1. 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:

  1. When we execute a Jack program, the first subroutine that starts running is:

    main()

  2. Can a subroutine in one Jack class access field variables of another Jack class?

No, unless you create getter methods.

  1. Which Jack classes should have a method for disposing objects?

All Jack classes should provide this.

  1. What does the keyword “this” implicitly refer to? (Select all that apply)
  2. In constructors: the current object
  3. In functions: the current object
  4. In methods: the current object
  5. In Main.main: the current object

 

  1. Which of the following are true about Jack classes? (Select all that apply)
  2. A Jack class must have a constructor
  3. A Jack class can contain either methods, or functions, but not both
  4. Each Jack class must be stored in a separate file
  5. Each Jack class must have a subroutine named “main”

 

  • Lab-09-High-Level-Language-vaawuu.zip