cs201 assignment no.1 2020 spring 2020

cs201 assignment no.1 2020 spring 2020
Assignment No. 1 Semester: Spring 2020 CS201 – Introduction to Programming |
Total Marks: 20
Due Date: 01/06/2020 |
||
Instructions
Please read the following instructions carefully before submitting assignment: It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date. o Submitted assignment does not open or file is corrupt. o Assignment is copied (From internet/students).
Recommended tool to develop Assignment – Dev C++
Objectives: To enable students to understand and practice the concepts of:
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 will not be accepted and will be scaled with zero marks.
For any query related to assignment, please contact cs201@vu.edu.pk.
|
|||
Assignment | |||
Create a menu based program using C++ which will calculate the increment and tax deduction amount on salary based on the pay scale of an employee. After this, net salary of employee will be calculated. Details of these calculations are provided in Solution Guidelines.
You are required to use initial salary, increment rate, and tax deduction rate given in following table for each of the given pay scale.
Solution Guidelines:
|
Solution:
#include<iostream>
using namespace std;
int main(){
int scale, initialSalary, incrementRate, taxDeductionRate;
float incrementValue, taxValue, netSalary = 0;
cout<<“*********** SALRY CALCULATOR **************\n”;
cout<<“*******************************************\n”;
cout<<“*********** ENTER 1 FOR SPS6 *************\n”;
cout<<“*********** ENTER 2 FOR SPS7 *************\n”;
cout<<“*********** ENTER 3 FOR SPS8 *************\n”;
cout<<“*********** ENTER 4 FOR SPS9 *************\n”;
cout<<“Select a payscale from the menu : “;
cin>>scale;
if(scale == 1){
initialSalary = 40000;
incrementRate = 20;
taxDeductionRate = 3;
}else if(scale == 2){
initialSalary = 60000;
incrementRate = 15;
taxDeductionRate = 3;
}else if(scale == 3){
initialSalary = 80000;
incrementRate = 10;
taxDeductionRate = 3;
}else if(scale == 4){
initialSalary = 100000;
incrementRate = 5;
taxDeductionRate = 3;
}else{
cout<<“You enter wrong scale\n”;
return 0;
}
incrementValue = ((initialSalary * incrementRate) / 100);
taxValue = (((initialSalary + incrementValue) * taxDeductionRate) / 100);
netSalary = (initialSalary + incrementValue) – taxValue;
cout<<“Initial Salary : “<<initialSalary;
cout<<“\nIncrement Amount : “<<incrementValue;
cout<<“\nIncreased Salary : “<<initialSalary + incrementValue;
cout<<“\nTex Deduction : “<<taxValue;
cout<<“\nNet Salary : “<<netSalary;
}