CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
CS201 ASSIGNMENT NO. 1 FALL 2022 || 100% RIGHT SOLUTION || INTRODUCTION TO PROGRAMMING || BY VuTech
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
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 theEmployee’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.
As a result, you should have the following output:
If the user enter 1:
If the user enter 2:
If the user enter 3:
If the user enters input other than 1, 2 and 3. Then program should prompt the user to enter the correct scale of the employee again.
Lectures Covered: 1 to 10
Due date: 05th December,2022
Visit Website For More Solutions
www.vutechofficial.blogspot.com
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
SOLUTION
#include <iostream>
using namespace std;
//Visit Website For More Solutions
//www.vutechofficial.blogspot.com
//SEND WHATSAPP OR E-MAIL FOR ANY QUERY
//0325-6644800
//kamranhameedvu@gmail.com
int employee(int scale){
int salary, houseRent, allowance, totalPay;
switch(scale)
{
case 1:
salary = 50000;
houseRent = salary * 10/100;
allowance = 3000;
totalPay = salary + houseRent + allowance;
cout<<"The Basic Salary is : "<< salary<<"\n"
<<"The House Rent is : "<<houseRent<<"\n"
<<"The Utility allowance : "<< allowance<<"\n"
<<"Net Payable Salary is : "<< totalPay;
break;
case 2:
salary = 70000;
houseRent = salary * 10/100;
allowance = 5000;
totalPay = salary + houseRent + allowance;
cout<<"The Basic Salary is : "<< salary<<"\n"
<<"The House Rent is : "<<houseRent<<"\n"
<<"The Utility Allowance: "<< allowance<<"\n"
<<"Net Payable Salary is: "<< totalPay;
break;
case 3:
salary = 90000;
houseRent = salary * 10/100;
allowance = 7000;
totalPay = salary + houseRent + allowance;
cout<<"The Basic Salary is : "<< salary<<"\n"
<<"The House Rent is : "<<houseRent<<"\n"
<<"The Utility allowance: "<< allowance<<"\n"
<<"Net Payable Salary is: "<< totalPay;
break;
default:
cout<<"Incorrect Range... "<<"\n"<<"Enter the scale of the employee (1 to 3): ";
break;
}
}
int main() {
int scale;
cout << "Enter the scale of the employee (1 to 3): ";
cin >> scale;
employee(scale);
return 0;
}
KINDLY, DON’T COPY PASTE
SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.