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 & Filtering

Write a program to compute the area of circle and triangle by using the pure virtual function.


Write a class Medical Staff that contains an attribute ID to store staff’s identity. The class contains

member functions to input and display ID. Write a child class Doctor that inherits Medical Class. It

additionally contains an attribute to store doctor’s PMDC number. It also contains member functions

to input and show the PMDC number. Write another class Skin Specialist that inherit Doctor Class. It

additionally contains an attribute to store working experience as specialist. It also contains member

functions to input and show the experience. Test these classes from main() by creating objects of

derived classes and testing functions in a way that clear concept of multi-level Inheritance.

b) Recall the Complex class that we implemented in operator overloading concept. Your task is to

provide implementation of the following method. friend ostream& operator<< (ostream& , const

Complex& )


Write the program, which has three classes one, is StudentRecord having members (degree,year) and functions (getdata), the 2nd class is called EmployeeRecordwhich has data members (emp_id and salary). The 3rd class is Manager having title, dues and an object of EmployeeRecord as well as StudentRecord. Create a function of getdata in all of these classes and call where necessary. Using this scenario, show how the concept of Composition works. 


a) Write a class Medical Staff that contains an attribute ID to store staff’s identity. The class contains member functions to input and display ID. Write a child class Doctor that inherits Medical Class. It additionally contains an attribute to store doctor’s PMDC number. It also contains member functions to input and show the PMDC number. Write another class Skin Specialist that inherit Doctor Class. It additionally contains an attribute to store working experience as specialist. It also contains member functions to input and show the experience. Test these classes from main() by creating objects of derived classes and testing functions in a way that clear concept of multi-level Inheritance.



Suppose you are a programmer in Agha Khan Hospital. Agha Khan Hospital Chairman has assigned a task you

to develop an application in regards to handle the data related to COVID-19 Vaccination Registration. Each

patient is provided with a security code needed for verification at the time of vaccination. Range of security

code is 1 to 10.

Task is to create a class COVID with 6 private data members name, cnic, security code, age, address and blood

pressure of patient. Class include public member functions

1. input ( ) function to input the attributes of patient

2. verify ( ) function to check security code provided at the time of registration

3. display ( ) function to display the patient cnic if security code is verified

4. show ( ) function to display the message NOT REGISTERED if security code doesn’t match

Define verify function outside the class using scope resolution operator


1

6. Which of the following statements about constructors is false?

a) Constructors doesn’t have a return value

b) Constructors are always user defined

c) Constructors are overloaded with different signature

d) Constructors may or may not have any arguments being accepted

7. Why do we utilise constructor overloading in the first place?

a) To use different types of constructors

b) because it’s a feature provided

c) To initialize the object in different ways

d) To differentiate one constructor from another



Apply nested loop concept to generate following pattern in output. However, number of times “$” sign get repeated in first row will be defined by the last digit of your SAP-ID+1


The address of memory location num1 and num2 are passed to function and the pointers *a and *b accept those values. So, the pointer a and b points to address of num1 and num2 respectively. When, the value of pointer is changed, the value in memory location also changed correspondingly. Write a program to swap the values in num1 and num2 using *a and *b. Use + and - operator for swapping

Runtime Input :

5

6

8

Output :

5


Form Rectangle from Triangles A rectangle shall be formed from many triangles. Given vertices of 'n' triangles ,with some triangles among them that can form a rectangle, design an algorithm and write a C++ code to determine the triangles that can form a rectangle. Print the vertices of the triangle in sorted order. That is triangles should also be sorted and the vertices in a triangle also should be sorted. A rectangle may contain four triangles as shown in figure below: For example, consider six triangles with the following vertices: Triangle 1 – (10, 6), (10, 16), (5, 6) Triangle 2 - (25, 8), (20, 4), (28, 6) Triangle 3 – (0, 6), (0, 16), (5, 6) Triangle 4 – (0, 16), (10, 16), (5, 6) Triangle 5 – (15,10), (20, 15), (25, 8) Triangle 6 – (0, 6 ), (5, 6 ), (10, 6) Triangle 1,3 and 4 can form a rectangle.


Write a file program to merge the content of source1.txt file and


source2.txt file to destination.txt file and display the fallowing from


the destination file.


• Count number of lines


• Count number of words


• Count the frequency of occurrence of the words


source1.txt


Hello Welcome to KSRCT


Hello Welcome to KSRCE


source2.txt


Hello Welcome to KSRIET


Hello Welcome to KSRCAS


Destination.txt


Hello Welcome to KSRCT


Hello Welcome to KSRCE


Hello Welcome to KSRIET


Hello Welcome to KSRCAS


Output display after reading from destination.txt file


Number of lines : 04


Number of words: 16


Frequency of words


Hello appears 4 times


Welcome appears 4 times


to appears 4 times


KSRCT, KSRCE, KSRIET and KSRCAS appears 1 times


LATEST TUTORIALS
APPROVED BY CLIENTS