C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a C++ program that will read in, for 20 employees, their employee number and the number of days absent for the year. You must then determine and display the following:


1. The employee numbers of all the employees who were not absent at all during the year.

2. The average number of days of absence for the year, and

3. The employee number of the person with the most days absent.


Write an application that ask the user for a letter grade A, B, C, D, E, or Q to quit. When the user types the user Q the program must end. Display the following using the information on the table below. Use a switch statement for the selection. When the loop terminates display how many A, B, C, D, or E were entered.


Grade Message

A Excellent

B Very Good

C Good

D Fair

E Poor


Question 6 [15 Marks] Write a C++ programme to create a class by name Employee. The Employee class should have the following data members 1. Employee_Id 2. Employee_Name 3. Position 4. Department 5. Basic_Pay 6. Deductions (Car Loans, Home Loans, and any other type of loans) The Employee class should have the following member functions. Accept()- It is used to get input for all data members. Total_Salary() – calculates the salary includes HRA 25%, DA 12% & Vehicle allowance 15% of Basic_Pay. This Basic_Pay will be varied based on the different positions. Display() - display all the data that has been received as input along with the calculated salary. Salary is calculated by the formula Salary = Basic_Pay + HRA + DA+ vehicle allowance - deductions. Create N number of Employee details with the necessary object for this class to run this program effectively. (Implement the OOPS concepts Polymorphism, inheritance, and Friend function wherever it is necessary)

You are required to build a class to represent the a cup of coffee. Call your class 

CoffeeCup. A coffee cup will have following characteristics 

1. type (sting) // can be mocha, cupaccino, etc 

2. temperature (float): represents the measure of 

temperature in degrees 

3. volume (float):// the volume of coffee in the cup in ml 

liters 

4. sugar (int):// no of teaspoons of sugar added to the coffee 

5. bool hasMore(): //this method checks if the cup has coffee in it that a person can take a sip 

from. For the implementation assume that one sip consumes a volume of 0.3 ml. So you will do 

some calculations in this method to check if it has any sips left depending upon the volume 

available. 

6. bool isEmpty(): // returns true if a person can take a sip from this cup and false otherwise 

7. bool takeASip():// this method represents the actual act of sipping. One sip is taken i.e. the 

volume equivalent to one sip is taken away. 

8. Provide a method print, that displays the status of the cup with respect to all data members. 



Define a class Customer that holds private fields for a customer's ID, first name, last name, address and credit limit.

Define functions that set the fields of customer. For example setCustomerID().

Define functions that show the fields of customer. For example getCustomerID().

Use constructor to set the default values to each of the field.

Overload at least six constructor of the customer class.

Define a function that takes input from user and set the all fields of customer data.

Define a function that displays the entire customer’s data.


Write a program to find the absolute value of a complex number (√(x^2+y^2)) using operator overloading of void return type.


What is the data type of pointer variables? Suppose that we don‘t know the name of a variable but we do know its address. Can we access the contents of that variable? Explain briefly.



Q: Write a program which defines three integer variables, var1, var2 and var3, & initializing them to the values 100, 200 & 300, it then prints out their addresses.



Q: Create a function “square”, which calculate and displays square of any number entered through the keyboard.  

Q:What is the data type of pointer variables? Suppose that we don‘t know the name of a variable but we do know its address. Can we access the contents of that variable? Explain briefly.


LATEST TUTORIALS
APPROVED BY CLIENTS