Cats love eating cockroaches. In C++ write all classes required to model a situation where a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Cats love eating cockroaches. In C++ write all classes required to model a situation where a cat can eat a cockroach. Note that cockroaches can have a random weight up to 50 grams (hint: use the rand function in C++). You MUST run and provide output on the following program. You are not allowed to make any changes to this program except for the one missing code block indicated. Sample Program: int main() { cat* c = new cat("Mr. Mistoffelees", 3.2); cockroach cr[10]; // missing code - please add this // code segment 11 Sample Program: int main() ( cat c = new cat("Mr. Mistoffelees", 3.2); cockroach cr[10]; } // missing code-- please add this // code segment 11 // before eating c->print(); // after eating for(int i=0; i<10; i++){ c->eat(cr[i]); c->print(); return 0; I Expected Output: Aggh Aggh cat's name is Mr. Mistoffelees and it weighs 3.2 kgs. you killed me (i.e, 0x85cc20) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.2415 kgs. you killed me (i.e., 0x85cca0) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.2845 kgs. Aggh you killed me (i.e., 0x85ccc0) cat's name is Mr. Mistoffelees and it Aggh you killed me (i.e., 0x85cce0) cat's name is Mr. Mistoffelees and it Aggh -- -- -- -- -- you bad cat weighs 3.323 kgs. you bad cat weighs 3.3305 kgs. you killed me (i.e., 0x85cd00) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.377 kgs. Aggh you killed me (i.e., 0x85cd20) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.3945 kgs. Aggh you killed me (i.e., 0x85cd40) you bad cat cat's name is Mr. Mistoffelees and it Aggh you killed me (i.e., 0x85cd60) you bad cat cat's name is Mr. Mistoffelees and it you killed me (i.e., 0x85cd80) you bad cat Aggh cat's name is Mr. Mistoffelees and it weighs 3.4375 kgs. weighs 3.4835 kgs. weighs 3.508 kgs. Aggh you killed me (i.e., 0x85cda0) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.5185 kgs. Please provide 1) formatted code, and 2) screenshots of your running program. Not ith or without errors) will limit your score to below 3/10. Cats love eating cockroaches. In C++ write all classes required to model a situation where a cat can eat a cockroach. Note that cockroaches can have a random weight up to 50 grams (hint: use the rand function in C++). You MUST run and provide output on the following program. You are not allowed to make any changes to this program except for the one missing code block indicated. Sample Program: int main() { cat* c = new cat("Mr. Mistoffelees", 3.2); cockroach cr[10]; // missing code - please add this // code segment 11 Sample Program: int main() ( cat c = new cat("Mr. Mistoffelees", 3.2); cockroach cr[10]; } // missing code-- please add this // code segment 11 // before eating c->print(); // after eating for(int i=0; i<10; i++){ c->eat(cr[i]); c->print(); return 0; I Expected Output: Aggh Aggh cat's name is Mr. Mistoffelees and it weighs 3.2 kgs. you killed me (i.e, 0x85cc20) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.2415 kgs. you killed me (i.e., 0x85cca0) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.2845 kgs. Aggh you killed me (i.e., 0x85ccc0) cat's name is Mr. Mistoffelees and it Aggh you killed me (i.e., 0x85cce0) cat's name is Mr. Mistoffelees and it Aggh -- -- -- -- -- you bad cat weighs 3.323 kgs. you bad cat weighs 3.3305 kgs. you killed me (i.e., 0x85cd00) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.377 kgs. Aggh you killed me (i.e., 0x85cd20) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.3945 kgs. Aggh you killed me (i.e., 0x85cd40) you bad cat cat's name is Mr. Mistoffelees and it Aggh you killed me (i.e., 0x85cd60) you bad cat cat's name is Mr. Mistoffelees and it you killed me (i.e., 0x85cd80) you bad cat Aggh cat's name is Mr. Mistoffelees and it weighs 3.4375 kgs. weighs 3.4835 kgs. weighs 3.508 kgs. Aggh you killed me (i.e., 0x85cda0) you bad cat cat's name is Mr. Mistoffelees and it weighs 3.5185 kgs. Please provide 1) formatted code, and 2) screenshots of your running program. Not ith or without errors) will limit your score to below 3/10.
Expert Answer:
Answer rating: 100% (QA)
include include include using namespace std class Coc... View the full answer
Related Book For
Accounting Information Systems basic concepts and current issues
ISBN: 978-0078025334
3rd edition
Authors: Robert Hurt
Posted Date:
Students also viewed these programming questions
-
You are required to model a vehicle parking lot system. The parking lot has a facility to park cars and scooters. The parking lot contains four parking lanes-two for cars and two for scooters. Each...
-
Use the RAND function in Excel to generate 100 values from a U (0, 1) distribution. (a) Calculate the average and compare it to 0.5, the expected value for a random sample between 0 and 1. (b) For...
-
Use the RAND function and the Copy command to generate a set of 100 random numbers. a. What fraction of the random numbers are smaller than 0.5? b. What fraction of the time is a random number less...
-
101, 115, 143, 106, 100, 142, 157, 163, 155, 141, 145, 153, 152, 147, 143, 115, 164, 160, 147, 150 (90%) Find the confidence interval of the median, indicated in parentheses, for the set of data.
-
Deng Chow Chan found that the basic income generated by his main product is 10 a unit, but this increases by 1 for every unit he makes. If he has to cover fixed costs of 100, how many units must he...
-
4. Explain the following: a) Magnet Schools b) Charter Schools c) Returns to Education d) Direct Student Loans
-
Consider the regression model in Problem 3.43. The value of the adjusted $R^{2}$ is Data From Problem 3.43 You have fit a linear regression model with three predictors to a sample of 50 observations....
-
How might the outcome of this case have been different if Cameron had been merely an aircraft parts supplier, with his only profit to be from the sale of components to Anderson?
-
Martinez Audio Visual Incorporated offers an incentive stock option plan to its regional managers. On January 1 , 2 0 2 4 , options were granted for 8 million $ 1 par common shares. The exercise...
-
On September 1, 201X, Dan Potter opened an auto repair shop. Here is his chart of accounts: Assets Liabilities Equity 101 Cash 201 Accounts Payable 301 Dan Potter, Capital 102 Accounts Receivable 302...
-
Problem 1: The adjusted trial balance of Debit Company is shown below: Debit Company Adjusted Trial Balance December 31, 2022 Cash Accounts receivable Supplies Prepaid Rent (3 months) Equipment, net...
-
Determine the beam column shown below is capable of safely carrying the applied loads. Given loads were determined by using LRFD provisions and bending moment diagrams are obtained from second order...
-
1. Explain the Conservation of Mechanical Energy using kinetic, gravitational potential, and thermal energy. 2. Describe how changing the mass, friction, or gravity affects the skater's energy. 3....
-
3. (a) Compute the following integral. The quantity a is simply a constant. Remember, do the integrals from the "inside out" (z first, then y, then x). Also, when doing an integral (say, the z...
-
9. What is the force on a 1.25 C charged quarter placed 15 cm from another quarter with -9.86 C of charge? F=_91-9 F- 1910) (1.25x105)(-9:46 X162) (0.15m)2 493N 10. How far away would the quarters in...
-
An anchored sheet pile wall is to support a mass of cohesionless soil with a horizontal surface up to a height of 6.0 m. The anchor ties are 1.25 m below the top of the retained soil. The depth of...
-
Inch Inc. took a loan of $1,350,000 to build a new office. Calculate the quarterly compounding interest rate charged on the loan if $44,136.87 was repaid at the beginning of every 6 months and the...
-
Saccharin is an artificial sweetener that is used in diet beverages. In order for it to be metabolized by the body, it must pass into cells. Below are shown the two forms of saccharin. Saccharin has...
-
Which type of coding system is indicated in each of the following independent situations? a. Airport codes (LAX, OGG) b. Automatically assigned transaction numbers in a cash register c. Consecutively...
-
Consider the following short case as you respond to the requirements for this problem: The Institute for Computer Enthusiasts (ICE) sponsors four computer seminars each year: Access, Excel,...
-
a. What four common classifications are often associated with computer crime? b. What computer crimerelated risks and threats are associated with information systems? c. What categories are commonly...
-
Approximately 50,000 new titles, including new editions, are published each year in the United States, giving rise to a $25 billion industry in 2001. In terms of percentage of sales, this industry...
-
When you think of political persuasion, you may think of the effortsthat political campaigns undertake to persuade you that their candidate is betterthan the other candidate. In truth, campaigns are...
-
In late 2013, the taxi company Yourcabs.com in Bangalore, India, was facing a problem with the drivers using their platformnot all drivers were showing up for their scheduled calls. Drivers would...
Study smarter with the SolutionInn App