Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Write simple C++ code, using only #include library, add comments and show output. Declare a class Salary it should have the following members i. An

Write simple C++ code, using only #include library, add comments and show output.
image text in transcribed
image text in transcribed
Declare a class Salary it should have the following members i. An integer called pay Amount (holds the amount of salary) ii. A float called income Tax Percentage (holds the % of income that is deducted as tax) Declare a class Staff it should have the following members: i. a char pointer to point to a name called namePtr (to save a location of the char array that holds the name) ii. an object of class Salary iii. a char pointer to point to the job description called jDescPtr (to save a location of the char array that holds the job description) iii. i. Declare an object of type Salary and give the object some values ii. Declare a pointer of type Salary and assign it the address of the object from i) What is the size of the object in i) in bytes. Explain the size you have mentioned. iv. What is the size of the pointer in ii) in bytes. Explain the size you have mentioned. Use the pointer in ii) to change the values of the member variables of the object it is pointing to V

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions