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

What are the eight elements of commerce?

Create a class student which stores name, date-of-birth and date-of-joining of a student. The data members date-of-birth and date-of-joining should be the objects of another class called 'date'. Input the data for 10 students and display it.


WAP to declare a class which stores a complex number. Include a member function which compares the modulus of the two complex class objects and returns the object with higher value. Include a parameterized constructor which arguments with same name as that of the class data members. 


A customer makes a purchase at the store. The tax rate is 8% on all purchases


except groceries. The store offers a 5% discount to seniors 60 and over. You


should ask the user three questions: what they have bought (use a menu


displaying bread, milk, or soap), what the purchase price is, and how old they are.


Your goal is to print a formatted invoice with the following line items: price, tax,


discount, and total. The discount should only be printed if applicable.


You should test your program with 5 data sets: with and without tax and with and


without the senior discount. The fifth data set makes an invalid choice of the


menu item, in which case your program should not ask any more questions and


output an error message.



Create a class employee which stores name, id and salary of an employee. Derive two [5]

classes ‘regular’ and ‘part-time’ from it. The class ‘regular’ stores TA, DA and grade-pay

and class ‘part-time‘ stores number of hours and pay-per-hour for an employee. Display

all the information for a regular and a part-time employee, using the concept of virtual

function.


For the program given below, write statements to call display function from base and

derived class in main.

class base

{

int x;

public:

base (int a){x=a;}

void display ( )

{ cout <<x<<"\n";}

};


class derived :public base

{ int d;

public:

derived (int a, int b): base (a)

{ d=b; }

void display ( )

{cout <<d;}

};


int main ( )

{ derived D(10,20);

return 0;

}



Insert, into the first stack, all the data above (which is the data of student’s names,

surnames and the marks they obtain in a particular assessment)

Display the content of the stack on the screen (console)

Then, remove all the students whose surname starts with the alphabets ‘R’, ‘J’ and

‘M’, from the first stack and insert them into the second Stack.Display the contents of Stack1 and Stack2. Finally, remove all the students whose marks are less than 50 from both Stack1 and Stack2 and insert them into the Third Stack. Display the contents of all the 3 Stacks. (30) 3b. Sort all the stacks in this order: Stack1 in alphabetic order by name Stack2 in alphabetic order by Surname Stack3 in Numeric order (descending) by marks obtainedSam Williams 60 2. John Phoenix 85 3. Simon Johnson 75 4. Sarah Khosa 81 5. Mat Jackson 38 6. Nick Roberts 26 7. Isaac Wayne 74 8. Anna Mishima

34 9. Daniel Rose 64 10. Aaron Black 83 11. Jack Mohamed 27 12. Kathrine Bruckner 4


For a given radius of a circle, calculate the area and print the size accordingly:

Size area

Size closed

Small 0-20

Medium 21-50

Large 50+


Write a pseudo code of a program that calculates and outputs how much a products

price has increased or decreased in percentage. If the new price is more than the original price, output

“Increased”, similarly If the new prince is less then original price output “decreased”.

ID

1

2

3

4

Original Price

4950

995521

56702

95040

New Price

7890

447984

28351

19008

Your output should have this format

ID X percent Increase

ID X percent decreased

Example

ID:5 65 percent Increased

ID:6 40 percent decreased


Since you are now a computer science student everyone believes you can solve problems

that are not easily solved by common people. One day your father calls you and say’s I have no idea why

our electricity bill is too high. He aspects you to solve the question luckily you know your electric supply

company calculates the electricity bill according to per unit rate which depends on how many units you

consumed. You have to write the pseudo code to calculate the electricity bill according to the following

criteria.

Criteria: For the first 100 units rate is 5.Rs per unit. For every next 100 units rate increased by 2.Rs

from previous one e.g 101 to 200 units have 7.Rs per unit rate.


LATEST TUTORIALS
APPROVED BY CLIENTS