Computer Science, asked by rimita58, 7 hours ago

(B) Write a program in Qbasic to accept the monthly income and the expenditure of your
family. Compare and check whether expenditure is more than monthly, monthly
income is more than the expenditure or both are equal Display an appropriate
message accordingly.​

Answers

Answered by vinojnct374
7

Answer:

Given an integer basic and a character grade which denotes the basic salary and grade of a person respectively, the task is to find the gross salary of the person.

Gross Salary: The final salary computed after the additions of DA, HRA and other allowances. The formula for Gross Salary is defined as below:

Gross Salary = Basic + HRA + DA + Allow – PF

Here, HRA = 20% of Basic

DA = 50% of basic

Allow = 1700 if grade = ‘A’

Allow = 1500 if grade = ‘B’

Allow = 1300 if grade = ‘C’

PF = 11% of basic

Examples:

Input: basic = 10000, grade = ‘A’

Output: 17600

Input: basic = 4567, grade = ‘B’

Output: 8762

Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Approach: The idea is to find the allowance on the basis of the grade and then compute the HRA, DA, and PF on the basis of the basic salary. Below is the illustration of the computation of HRA, DA, and PF:

HRA: House Rent Allowance is 20% of the basic salary:

HRA = Basic Salary * 0.20

DA: Daily Allowance is the 50% of the basic salary:

DA = Basic Salary * 0.5

PF: Provident Fund is the 11% of the basic salary.

PF = Basic Salary * 0.11

Below is the implementation of the above approach:

// C++ Program to implement

// the above approach

#include <bits/stdc++.h>

using namespace std;

// Function to calculate the

// salary of the person

int computeSalary(int basic,

char grade)

{

int allowance;

double hra, da, pf;

hra = 0.2 * basic;

da = 0.5 * basic;

pf = 0.11 * basic;

// Condition to compute the

// allowance for the person

if (grade == 'A') {

allowance = 170

gross = round(basic + hra + da + allowance - pf);l

int basic = 10000;

char grade = 'A';

cout << computeSalary(

Similar questions