Orientation – Explicit Types, semi-colons, and curly braces… oh my!
This lab is designed to highlight many of the differences between Python and Java. Many of the differences are purely syntactical. Other features, like for loops, function differently. If you are like me, you will need to get back in the habit of using your semi-colons!
Those already familiar with Java should finish the lab and then offer to help others.
This is a half week lab
Objectives
To be able to translate a Python program to Java.
To be able to develop and run a complete Java program.
To be able to compile and run a Java program on unix1-4
Your peers
Your instructor
The Java Standard Library - Bookmark this web page, you will be using the Java Standard Library documentation regularly this quarter.
Retrieve the files provided for this lab by
accepting the assignment from git classroom here:
You may collaborate with your peers as much as you like on this lab. Labs are for your practice. Make sure you can do every lab!
For this lab you will be "required" to compile and run Java from the
command-line. Yes, even though there are very good IDEs available for
Java, running on the command-line is still a valuable skill (you will
use an IDE for later labs).
To compile the java lab code file, type:
javac Lab00.java
To run the code then type:
java Lab00
- From the starting code run lab00.py. Make sure you understand how everything in this file works. If you need help (or haven’t learned Python) please ask me or a classmate to explain things. You will NOT be tested on Python this quarter, but will need to understand this file enough to write an equivalent java version.
- Now take a look at the file Lab00.java. This file is incomplete and you will need to finish it. Translate the given Python file to Java. Please translate everything, including the comments!
Remember:
To compile your files, type:
javac Lab00.java
To run the code then type:
java Lab00
Demonstrate your working program to your instructor. Be prepared to show your source code. Come to lab on the due day with your lab finished!