Question: 4 1 CSCI 1 3 0 2 Programming Principles II Georgia Southern University Department of Computer Science Fall 2 0 2 4 Lab 3 Point
CSCI Programming Principles II
Georgia Southern University
Department of Computer Science
Fall
Lab
Point Value: points
Due: Friday August end of lab
Objectives
Update an existing class to explore aggregation and composition.
Review UML language and documentation.
Use debugging techniques to debug and correct code.
Use the IDEs builtin debugger to debug and correct code.
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. Submit Java source code files to 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. On Gradescope, you can
choose to add a group member, once one person has submitted the code file, must be
done to every submission.
Your submitted zip file should be named Lab#LastNameLastNamezip. For instance,
LabJonesSmith. Any requested screenshots andor 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: PAssignjava
Class: CSCI
Author: Christopher Williams
Created on: Jun
Last Modified: Aug
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.
Lab Problems
For all problems, use inline comments to describe major actions. Ask for assistance if needed.
NOTE: For this lab, you will be using the WaterBottle class and test program provided in Folio.
You will need to modify the test program to test the new classes you will be building.
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.
ComposedAggregated Objects Create a new class named LunchBag. LunchBag should
have data members of length, width, height, and a water bottle. All LunchBags have a bottle
holder that can hold a WaterBottle that can be purchased separately from the LunchBag so
it can be created in a main method and passed to the LunchBag class
Additional Requirements
a A default LunchBag should have dimensions of L x W x H
b There should be a default constructor that sets default values for the LunchBag. Create
a default WaterBottle in this constructor: setWaterBottlenew WaterBottle;
c There should be a convenience constructor that takes four parameters that match all
data members in the order they are listed in the description above.
d All LunchBag data members should have an accessor and a mutator and all values
should be positive. If they are not positive, set them to their default values.
This includes the WaterBottle data member which should also have an accessor
and a mutator.
e A LunchBag can hold a WaterBottle as long as the diameter is positive and less than or
equal to
If a WaterBottle is set using the appropriate mutator method, an error message
should be printed if the WaterBottle cannot be stored and a default WaterBottle
should be used in its place.
Note that an error message in the mutator is not the most appropriate
way to accomplish this. In Chapter we will learn the correct way.
Submit both your WaterBottle and LunchBag classes to Gradescope.
ComposedAggregated Objects Create a new class named LunchBox. LunchBox should
have data members of length, width, and a water bottle. All LunchBoxs come with an
included WaterBottle that is manufactured at the same time as the LunchBox and cannot be
replaced with offtheshelf WaterBottles we have no way of preventing this at the moment
because users will have access to the accessor method similar to the immutable example in
the slides
Additional Requirements
a A default LunchBox should have dimensions of L x W x H
b The default WaterBottle that comes with the LunchBox is H and R
o As a composed object, this should be created at the same time as the LunchBox.
c There should be a default constructor that sets default values for the LunchBox and
instantiates the WaterBottle with the correct dimensions as a composed object.
d There should be a convenience constructor that takes four parameters that match all
data members in the order they are listed above.
e All LunchBox data members should have an accessor and a mutator and all values
should be positive. If they are not positive, set them to their defau
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
