Question: Data structures / Basic OO and encapsulation Let's apply our OO principles. Create a can class, such as a can of soup, only it can
Data structures /
Basic OO and encapsulation
Let's apply our OO principles.
- Create a can class, such as a can of soup, only it can be anything on a shelf at a grocery store.
- Call your file/class CanYourLastName. First define your class variables: Company, Content, Size (usually in ounces), Price. (decide which data types make the most sense)
- Next, define a default constructor (takes no arguments) and various other constructors.
- Next, define getters and setters, mutators and accessors, depending on your language.
- Next, make sure you have a method to display your object.
- Make sure you have tester/driver class or main method to create and print objects.
- Include a comment in your tester/driver class or main method with the Big-O complexity denoted.
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
