

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A lab assignment for a computer science i course where students are required to write java programs based on exam problems. The assignment includes creating directories and java files for each problem, implementing and testing methods, and writing main methods for testing. Students are encouraged to explain their output and show their work.
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!
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
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.
Explain the output.
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.
Explain the output.
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!).
Explain what you have done.
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.
Show us your work.
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.