Question: CSCI 1 3 0 2 Programming Principles II Georgia Southern University Department of Computer Science Fall 2 0 2 4 Lab 2 Point Value: 2

CSCI 1302 Programming Principles II
Georgia Southern University
Department of Computer Science
Fall 2024
Lab 2
Point Value: 20 points
Due: Friday August 23,2024, end of lab
Objectives
1. Update an existing class to use OO principles.
2. Pass and return objects to/from methods.
3. Use debugging techniques to debug and correct code.
4. Use the IDEs built-in debugger to debug and correct code.
5. Archive Java source code files and other documents into a zip file.
Description
Complete the following steps as described and upload requested materials to Folio in the
appropriate Dropbox in a single zip file. Also upload the requested materials to the appropriate
section of Gradescope.
Students should work in groups of two for this lab. When submitting your zip file, fill out
the comment header and indicate both group member names.
Your submitted zip file should be named Lab#LastName1LastName2.zip. For
instance, Lab2JonesSmith. Any requested screenshots and/or answers to questions
should be included in a separate Word document.
All programs should have a comment header. That comment header should include
information similar to:
/**
* File: PAssign0.java
* Class: CSCI 1302
* Author: Christopher Williams
* Created on: Jun 6,2016
* Last Modified: Aug 16,2018
* Description: Display three messages to the console
*/
Before writing any code, for each problem, discuss with your partner how you plan to
approach solving the given problem. Once you both agree on a way to attempt the
problem, only then should code be written.
Pay attention to names and any other requested material. Failure to include material will
result in the loss of points as described below.
2
Lab Problems
For all problems, use inline comments to describe major actions. Ask for assistance if needed.
NOTE: For this lab, you will be modifying the WaterBottle class and test program provided
in Folio. Look for the TODO comments and delete each comment when you complete it.
These show up in Eclipse in the Tasks tab: Windows -> Show View -> Tasks.
1. Objects and Classes (Visibility) Using your WaterBottle class and make the
following updates:
Additional Requirements
Update all instance members, constructors, and methods so they have the correct,
recommended visibilities according to OOP convention.
Add accessor (get) and mutator (set) methods for all data members.
All data members should have a value greater than 0.0.
If a client tries to set a value of 0.0 or below, set the data member to the
default value(s) of 12.0 height and 2.0 radius. These values should be
checked in the appropriate mutator only and all methods should have the
correct visibility.
Update all constructors so they use the newly built mutator methods.
Once your class is complete:
Update your test program (WaterBottleTest.java) to test all additions to the class. It
may be helpful to create an array of WaterBottles to gain practice using those items.
Verify that all values are being set correctly by printing them to the Console or using the
debugger to test the additional items. Make sure to test any values that contain a
defined range by attempting to update that value incorrectly.
You do not need to include WaterBottleTest.java when submitting to Gradescope as
it will create its own WaterBottle instances and test all required components.
After instructor/TA check-off, BOTH students should submit a final, identical version to
Gradescope. This version is used for your final grade.
2. Objects and Classes (Static Items) Using your WaterBottle class from Problem 1 and
make the following updates:
Additional Requirements
Add a static data member named largestInitialVolume with the appropriate data
type and visibility.
Add an accessor for the largestInitialVolume data member with the correct visibility,
modifiers, return type, name, and parameter list. This method should return the value
of the largestInitialVolume by accessing it in a static context.
3
Add a public method named checkInitialVolume() that determines if a WaterBottle has a
larger volume than the largestInitialVolumes current value. If so, update the
largestInitialVolume by accessing it in a static context. Provide the appropriate visibility,
return type, and parameter list for this method.
Update your class so that the checkInitialVolume() method is called upon WaterBottle
creation and appropriately sets the static members value. Double check that the
correct value is populated no matter which constructor is used.
Once your class is complete:
Update your test program (WaterBottleTest.java) to test all additions to the class.
Verify that all values are being set correctly by printing them to the Console or using the
debugger to test the additional items.
You do not need to include WaterBottleTest.java when submitting to Gradescope as
the autograder will create its own instances and test all required com

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!