Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1: Make a box that can hold anything This first part checks that you know how to use generics, write JavaDocs, and use the
Part 1: Make a box that can hold anything This first part checks that you know how to use generics, write JavaDocs, and use the basic command line tools you'll use throughout the semester. You need to write a generic class called singleItemBox (in a file called singleItemBox. java that you create). This class has a constructor that takes a single item (of any type) and puts it in the box. You also need a method called getritem () which provides the item back to the user but does not remove it from the box (this is an "accessor", if you remember, sometimes called a "getter"). Make sure to comment your code as you go in proper JavaDoc style. To check that you've got the right idea, we've provided a class called BoxUsageDemo. java which shows creating three different boxes that store different things (an apple, a banana, and a cat). You should not alter this class to "make it work", but rather alter your box to allow the provided code to work. You can use the command "java BoxUsageDemo" to run the testing code defined in main (). You could also edit this main () to perform additional testing (we won't be using BoxUsagedemo for testing, it's just a demo for you). Note that JUnit test cases will not be provided for SingleItemBox, but feel free to create JUnit tests for yourself. A part of your grade will be based on automatic grading using test cases made from the specifications provided
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started