Question
In c++ please show what code is for what file and what file to run the code from im confused and how to call the
In c++ please show what code is for what file and what file to run the code from im confused and how to call the codes from other files
Provide an implementation of the egg carton class described below. Develop test code that tests your implementation (edge cases should be covered). You should have three separate source code files similar to exercise 1.
+----------------------------------------------------------------+
| | | EggCarton | | |
+----------------------------------------------------------------+
| | | data fields:
| | - brownEggs : int
| | - whiteEggs : int | | |
+----------------------------------------------------------------+
| | | member functions: | |
+ EggCarton() //set initial values to 0 and 0 | |
+ EggCarton(brownEggs : int, whiteEggs : int) | |
// set initial values to 0 and 0 if the total number | |
// of eggs is larger 12 | |
+ addBrownEggs(n : int) : bool | |
+ addWhiteEggs(n : int) : bool | |
+ getTotalEggs() : int | | |
+----------------------------------------------------------------+
Figure 1
The class structure for the EggCarton class is shown in Figure 1. Instances of this class represent egg cartons that can hold up to 12 eggs. The class provides functions to add white and brown eggs. All of the functions that modify the number of eggs in the carton return false if the operation cannot be done exactly as requested. For example, if there are 3 white eggs and 0 brown eggs, then addBrownEggs(10) returns false and the number of white eggs remains at 3 and brown eggs at 0. There is a member function called getTotalEggs, which returns the total number of white and brown eggs together. For example, if the carton has 1 brown and 2 white eggs, then getTotalEggs returns 3. (Appropriate function comments are expected for all functions.)
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