Professional Documents
Culture Documents
REGISTRATION NO :BCS231095
ASSIGNMENT
QUESTION NO.01
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int employee1 = 1, employee2 = 2, n;
float netpay,grosspay, tax = 40, IRA = 10, deduction;
cout << "Please press 1 for 1st Employee: \n";
cout << "Please press 2 for 2nd Employee: \n";
cin >> n;
if (employee1 == n)
{
grosspay = 16.43 * 20;
cout << "The gross pay amount of employee is: \n"
<< "$" << grosspay << endl;
deduction = tax + IRA;
netpay = grosspay - deduction;
cout << "The net pay of employee is: \n"
<< "$" << netpay << endl;
}
else if (employee2 == n)
{
grosspay = 12.67 * 20;
cout << "The gross pay amount of employee is: \n"
<< "$" << grosspay << endl;
deduction = tax + IRA;
netpay = grosspay - deduction;
cout << "The net pay of employee is: \n"
<< "$" << netpay << endl;
}
else
{
cout << "Pardon me but the entered valued are invalid,enter 1 or 2 only\n";
}
}
OUTPUTS FOR QUESTION 1
QUESTION NO. 02
#include <iostream>
using namespace std;
int main()
{
float t = 20, d = 14, initialspeed = 50;
float s,distance;
s = initialspeed / 3600 ;
distance = s * t - (1 / 2) * d * t * t ;
cout << "Since the car traveled after 20 second so the distance will be : \n"
<< distance << " Miles Per Second(mps)" << endl;
char n;
cout << "PLEASE ENTER A CHARACTER" << endl;
cin >> n;
switch (n)
{
case 'a':
cout << "Option A is selected" << endl;
break;
case 'b':
cout << "Option B is selected" << endl;
break;
case 'c':
cout << "Option C is selected" << endl;
break;
case 'd':
cout << "Option D is selected" << endl;
break;
default:
cout << "Invalid option selection" << endl;
break;
}
}
#include <iostream>
using namespace std;
int main()
{
int x;
char variables;
cout << "Enter an INTEGER ";
cin >> x;
#include <iostream>
using namespace std;
int main()
{
int X, c, y;
cout << "Enter any positive number: ";
cin >> X;
cout << "Multiplication table for 1 to " << X << " is as follows:" << endl;
for (int c = 1; c <= X; c++)
{
for (int y = 1; y <= X; y++)
{
int product = c * y;
cout << product << "\t";
}
return 0;
}