Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Must contain Main.cpp and Grasshopper.h file. Thank you. Objectives To strengthen student's knowledge of C++ programming To give student experience in writing Object Oriented code

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Must contain Main.cpp and Grasshopper.h file. Thank you.

Objectives To strengthen student's knowledge of C++ programming To give student experience in writing Object Oriented code Background Digital grasshoppers are very hungry and very greedy; if there is any room in their stomach, a digital grasshopper will attempt to eat just about anything that is nearby. Most digital grasshoppers prefer grass, seeds, and bugs. Digital grasshoppers are also fussy eaters; if they are unable to completely consume an object, they spit it back up completely Digital grasshoppers are very rarely satisfied with their last meal; they can empty the contents of their stomachs in two ways: 1. they can vomit the last meal they consumed at potential threats or just to make room 2. they can excrete the oldest meal still in their stomach to make room as well. Digital grasshoppers can be trained to perform any of the above actions on command. Instructions Write a program that allows a user to issue a series of instructions to a digital grasshopper and reports on the grasshopper's responses and status. Your program must model the following behaviors Train - creates a new digital grasshopper of the indicated. This will delete the previous digital grasshopper, so it should warn the user and ask them to commit before continuing. 1. 2. Eat - the grasshopper attempts to eat the indicated . Should indicate whether it successfully ate the item or not. 3. Excrete - remove the oldest item the grasshopper has eaten from its stomach. Should indicate which item was excreted or if the stomach was empty. 4. Vomit remove the newest item the grasshopper has eaten from its stomach. Should indicate which item was vomited or if the stomach was empty. Report-list the contents of the grasshopper's stomach, then output HUNGRY if the grasshopper's stomach is empty or FULL if the grasshopper's stomach is full 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago