google.com, pub-3534375712831849, DIRECT, f08c47fec0942fa0 CS201 Assignment 1 Solution Fall 2022 | Download solution in PDF from Website Free Assignment / GDB
Latest Updates
Loading...

CS201 Assignment 1 Solution Fall 2022 | Download solution in PDF from Website Free Assignment / GDB








Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

 

                     Assignment is submitted after due date.

                     Submitted assignment does not open or file is corrupt.

                     Assignment is copied (From internet/students).

 

Recommended tool to develop Assignment

         Dev C++

 

Objectives:

To enable students to understand and practice the concepts of:

         Data Types and Variables

         Arithmetic and Logical Operators

         Expression Solving

         If-else Statements

         Repetition Structure

         Function

 

 


Assignment Submission Instructions

You have to submit only .cpp file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format(like doc, docx, pdf, giff,jpg etc.) will be scaled with zero mark. So, check your solution file format before submission.

 

For any query related to assignment, please contact cs201@vu.edu.pk.

 

 

Lectures: 1 to 10

Write a C++ program to prompt the user to enter the Scale and then print the Employee’s Basic Pay, House Rent Allowance and Total Pay by using a function.

 

Calculations are given as:

Scale

Salary

House Rent(% of salary)

Utility Allowance

1

50000

10

3000

2

70000

10

5000

3

90000

10

7000

 

Note: The scale should be between 1 and 3 otherwise the system will ask for the correct scale again.



Solution:

#include <iostream>

using namespace std;




int employee(int scale){

int salary, houseRent, allowance, totalPay;



switch(scale)


{


//switch statement


case 1: //case1

salary = 50000;

houseRent = salary * 10/100;

allowance = 3000;

totalPay = salary + houseRent + allowance;

cout<<"\n";

cout<<" The Basic Salaryis  : \t"<<salary <<"\n The House Rentis  : \t"<<houseRent <<"\n Utility Allowance: \t"<<allowance <<"\n The Total Payis : \t"<<totalPay;


break;



//break statement

case 2: //case1

salary = 70000;

houseRent = salary * 10/100;

allowance = 5000;

totalPay = salary + houseRent + allowance;

cout<<"\n";

cout<<" The Basic Salaryis  : \t"<<salary <<"\n The House Rentis  : \t"<<houseRent <<"\n Utility Allowance: \t"<<allowance <<"\n The Total Payis : \t"<<totalPay;


break;


//break statement

case 3: //case1

salary = 90000;

houseRent = salary * 10/100;

allowance = 7000;

totalPay = salary + houseRent + allowance;

cout<<"\n";

cout<<" The Basic Salaryis  : \t"<<salary <<"\n The House Rentis  : \t"<<houseRent <<"\n Utility Allowance: \t"<<allowance <<"\n The Total Payis : \t"<<totalPay;

break;


default:

cout<<"Incorrect Range... \nEnter the scale of employee(1-3)";

break;

}

}



int main()

{

int scale;


cout<<"\t \t CS201 assignment 1 Solution Fall 2022";

cout<<"\n \t \t by Abdul Hadi E Services ";

cout<<"\n \t   -------------------------------------------- \n";


cout << "Enter your scale of the employee (1-3): ";

cin >> scale;

employee(scale);


return 0;



}



 

Get Paid Services (CPP Ready File)





Want more info, please press the below button




`

Post a Comment

0 Comments