Docsity

Laboratory Assignment 8 for CIS 201 - Computer Science I, Lab Reports of Computer Science

Toggle sidebar
bg1
CIS 201 – Computer Science I
Laboratory Assignment 8
Introduction
In this lab you will redeem yourself by writing programs to implement and/or test your exams
problems.
Create a directory,
Lab08
in your
CS1
directory. You will be creating Java programs in this di-
rectory named
Prob1.java
,
Prob2.java
, and so forth, corresponding to the questions on Exam
2.
Prob1
Create a program named
Prob1.java
with the contents of problem 1 in your exam. Instead of the
class name
Temp
, use the class name
Prob1
.
Compile and run this program. Compare the output with what you gave on your exam.
Checkpoint 1
Explain the output.
Prob2
Create a program named
Prob2.java
with the contents of problem 2 in your exam. Instead of the
class name
Temp1
, use the class name
Prob2
.
Compile and run this program. Compare the output with what you gave on your exam.
Checkpoint 2
Explain the output.
1
pf3

Partial preview of the text

Download Laboratory Assignment 8 for CIS 201 - Computer Science I and more Lab Reports Computer Science in PDF only on Docsity!

CIS 201 – Computer Science I

Laboratory Assignment 8

Introduction

In this lab you will redeem yourself by writing programs to implement and/or test your exams problems.

Create a directory, Lab08 in your CS1 directory. You will be creating Java programs in this di- rectory named Prob1.java, Prob2.java, and so forth, corresponding to the questions on Exam

Prob

Create a program named Prob1.java with the contents of problem 1 in your exam. Instead of the class name Temp, use the class name Prob1.

Compile and run this program. Compare the output with what you gave on your exam.

Checkpoint 1

Explain the output.

Prob

Create a program named Prob2.java with the contents of problem 2 in your exam. Instead of the class name Temp1, use the class name Prob2.

Compile and run this program. Compare the output with what you gave on your exam.

Checkpoint 2

Explain the output.

Prob

Create a program named Prob3.java with class name Prob3 and with the prototypes given in problem 3 in your exam. Don’t worry about copying the documentation.

Implement the swap, randomInt, and shuffle methods, using what you did for your 15-Puzzle assignment. The randomInt and swap methods should be almost identical to what you were given in the 15-Puzzle assignment, except that your swap method will use the formal array parameter instead of the ArrayList field variable.

Write a main method that tests your shuffle method. This should look almost the same as the main method in your Shuffle.java program for your last assignment. Be sure that you do more than one test, with different array sizes (including an array of size zero!).

Checkpoint 3

Explain what you have done.

Prob

Create a program named Prob4.java with class name Prob4. Implement the intArrayToArrayList method and write a main method that tests your method. The test should verify that the sizes of the given array and ArrayList are identical and that the equality expression holds.

Checkpoint 4

Show us your work.

Prob5, Prob6, and Prob

As you have done for the previous problems, create appropriate Java files containing the appropri- ate class names. Implement the method described in the exam problem and write a main method that tests your implementation.