CSU Banner

CS 163/164, 🀨 Fall 2019 🀨

Lab 9 - Starting P6 and Interpreting Java

Tuesday, Oct. 1st or Wednesday, Oct. 2nd


Objectives of this Lab

  1. Setup for the Maze programming assignment,
  2. introduce you to declaring and calling methods, and
  3. show how method parameters and return values work.

Maze Assignment

Part of this lab is setting up for the P6 assignment, in which you control a character in a maze. The assignment requires a variety of data files, image files, and a graphical user interface class. Before working on this lab, go to the P6 assignment. With the help of your TA, complete all of the Getting Started section of the assignment.

Interpreting Java

For this lab, we are starting by studying methods in the classes supplied by Java. You are already familiar with many of these methods. Create a project Interpret and a class, and enter the answers to the following questions in comments in Interpret.java. List the type of the return value and parameters to each of the following methods: From the following calls, figure out what the return type and parameters might be:
int count = computeNumberOfLetters("Hello There!");

double percent = findRatio(0.567f, 1.234f, 2.568f, 5.678f, 9.235f);

char special = someMethod(s.substring(1, 8), Character.isUpperCase(c), Math.pow(2.0, 3));

String string = anotherMethod((int)'c', (int)'a', (char)78, (char)99, "Whatever");
Your TA will discuss the answer to the questions.

Grading

Show your completed P6 setup and your Interpret comments to your TA for credit for the lab.

CS Banner
CS Building