Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implment in C++ Exercise 1: Create a class Resource. The class should have: a) Two private variables status and writeTo representing integer value either0 or

image text in transcribed

Implment in C++

Exercise 1: Create a class Resource. The class should have: a) Two private variables status and writeTo representing integer value either0 or 1 b) One default constructor that initializes the status and writeTo to zero. c) One single parameterized constructor to initialize the writeTo variable d) Two constant accessor functions per class that return the values of status and writeTo separately Two mutator functions per class that set the values of status and writeTo separately. One output (member) function that outputs the resource status. The output function should be able to print on the screen or an output file. e) f) void output (gstream &out_stream); g) A friend function check status that accesses the status variables of two input objects. If status in each resource object is set to"i", display "resource available" else display "resource unavailable". bool check_status (Resource &res1, Resource &res2) // Define status checking code here. // return true if resl status and res2 status are both 1 // else return false. Exercise 1: Create a class Resource. The class should have: a) Two private variables status and writeTo representing integer value either0 or 1 b) One default constructor that initializes the status and writeTo to zero. c) One single parameterized constructor to initialize the writeTo variable d) Two constant accessor functions per class that return the values of status and writeTo separately Two mutator functions per class that set the values of status and writeTo separately. One output (member) function that outputs the resource status. The output function should be able to print on the screen or an output file. e) f) void output (gstream &out_stream); g) A friend function check status that accesses the status variables of two input objects. If status in each resource object is set to"i", display "resource available" else display "resource unavailable". bool check_status (Resource &res1, Resource &res2) // Define status checking code here. // return true if resl status and res2 status are both 1 // else return false

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions