Questions: 9 913

Answers by our 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 & Filtering

Write a program to calculate gross and net pay of employee from basic salary. Create employee class which consists of employee name, emp_id, and basic salary as its data members. Use parameterized constructor in the derived class to initialize data members of the base class and calculate gross and net pay of the employee in the derived class.

What number will the following code snippet print

double x = 3.5; 
double y = 0;

if ( x <= 2 ){
   y = 1;
}
else if( x <= 4){
   y = 2;
} 
else {
   y = 3;
} 

x = y;
cout << "Number:" << x << endl;

Please provide the numerical value of x which is printed at the end. This question will only accept numbers as answers.


The following expression has a mistake

if( x =! 0 )

Please provide the corrected version




Let’s implement the concept of doubly linked list with a real time example.

For a bogie we need following information:

struct bogie{

string Name;

char type; //B for Business Class, F for First Class, and E for Economy class

int capacity; //Between 50-70

int fare; //For Business Class 1200, For First Class 1000, For Economy class 500

bogie *next;

bogie *prev;

};

bogie *engine //use as head for the train

Define a class, name it Train and write following functions for that class:

i. Insert a bogie at front();

ii. Insert a bogie at given position() //position will be defined based on name of bogie

iii. Insert a bogie at the end()

iv. return seating capacity of each type()

v. return total number of seats()

vi. return maximum fare collection based on total capacity of train()


Write C++ program by using while loop to display the following output


+---------+

|  *  |

|  /*\  |

| //*\\ |

| ///*\\\ |

| \\\*/// |

| \\//  |

|  \*/  |

|  *  |

+---------+

| \\\*/// |

| \\//  |

|  \*/  |

|  *  |

|  *  |

|  *  |

|  /*\  |

| //*\\ |

| ///*\\\ |

+---------+


Write a C++ program that prints on the screen following diamond shape with given series of numbers. 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25.

C++ program that converts a decimal number to a binary, octal, and hexadecimal equivalents. First, the program will ask to fix a range for the lower and

upper limit in which the conversion is required. The lower limit should not be less than

0 and greater than the upper limit. For example, if you enter a negative number or

greater than the upper limit, then the program should print a message for the invalid

input and will ask you again to enter a decimal number within the range. If you

correctly specify the upper and lower limits, then the program will print a table of the

binary, octal and hexadecimal equivalents of the decimal numbers in the range of

lower limit through upper limit.

for while and do while loops must be used only once. anything else is not allowed to be used. functions can also be not used.


Example output:

Enter upper limit = 12

Enter lower limit = 30

Invalid.

Enter lower limit again = 10

Further table will be printed .


A number is called a happy number, if you start with the given number

and arrive at 1 by repeating the following process (as illustrated in the below example): (a)

compute the sum of the squares of given number digits (b) if the resultant value is 1, then

the number is happy number, else execute point (a) for the newly produced number.

Note that if a number is not a happy number, there will be an endless loop to this execution.

Goal: In this question, you are required to write C++ code that checks whether the number entered by the user is a happy number or not for 10 cycles/iterations only.

Example: Assume a number 19

Number Computation Result cycle/iterations



19 1^2 + 9^2 82 1


82 8^2 + 2^2 68 2


68 6^2 + 8^2 100 3


100 1^2 + 0^2 +0^2 1 4


Write a program to find the table of numbers using a while loop. Your program should ask the size of the table. That size defines the rows and columns. Sample output:


IT must be done using WHILE loop.


Enter size: 6

1 2 3 4 5 6

------------------------------------------

1* 1 2 3 4 5 6

2* 2 4 6 8 10 12

3* 3 6 9 12 15 18

4* 4 8 12 16 20 24

5* 5 10 15 20 25 30

6* 6 12 18 24 30 36


write A C++ program to display output using while loop only


+------+

| ^^ |

| ^ ^ |

|^  ^|

| ^^ |

| ^ ^ |

|^  ^|

+------+

|v  v|

| v v |

| vv |

|v  v|

| v v |

| vv |

+------+


LATEST TUTORIALS
APPROVED BY CLIENTS