To Lecture Notes

IT 372 -- May 14, 2025

Review Questions

  1. Write an Android app that draws vertical lines in a MyView object placed in a linear layout. Use radio buttons to specify the color: red, blue, and white.
    Answer: activity_main.xml  MainActivity.java  VertLine.java  MyView.java
  2. Write an Android app that displays a circle in a MyView object placed in a linear layout. Use a seekbar to change the radius of the circle from 30 to 200 pixels and back.
    Answer: activity_main.xml  MainActivity.java  MyView.java
  3. In what ways is Kotlin similar to and different from Java?
    Answer. Similarities:
    -- Both run on the Java Virtual Machine (JVM).
    -- Datatypes of variables are determined at compile time (statically typed).
    -- Both are object oriented.
    -- Both use // for comments and { } for block delimiters.
    Differences:
    -- Kotlin is more concise than Java.
    -- Kotlin does not require semicolons at the end of lines.
    -- Kotlin constructors are implemented as parameters to the class itself.
  4. After looking at the examples in the Introduction to Kotlin document, implement the Magic8Ball Example using Kotlin for the Prediction and MainActivity classes.

Introduction to Kotlin

Look at these sections in the Introduction to Kotlin document.