www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# CS201 - Introduction to Programming Assignment No. 1 Due Date Jun 01, 2020

Lesson:  1 to 8. Switch Statement

Due Date: 01.June.2020

Total Marks: 20

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Views: 1506

Attachments:

### Replies to This Discussion

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided.

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

CS201 Introduction to Programming Assignment 1 Solution & Discussion Spring 2020

Solution Idea:

//program calculate net pay on the basis of increrment, tax deduction on the basis of net salary
#include <iostream>
using namespace std;

main()
{
//delare and initialize the variables
int payScale=0;
int ini_Salary=0;
int inc_Salary=0;
int upd_Salary=0;
int tax_Deduction=0;
int net_Salary=0;

cout"************* SALARY CALCULATOR ***************"endl;
cout"\n************* ***************** ***************"endl;
cout"\n************* Enter 1 for SPS6 ***************"endl;
cout"\n************* Enter 2 for SPS7 ***************"endl;
cout"\n************* Enter 3 for SPS8 ***************"endl;
cout"\n************* Enter 4 for SPS9 ***************"endl;
cout"\nSelect a pay scale from the menue : ";
cin>>payScale;

//switch statement
switch (payScale)
{
case 1:

//calculation
ini_Salary=40000;
inc_Salary = ini_Salary * 20/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 2:
ini_Salary=60000;
inc_Salary = ini_Salary * 15/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 3:

ini_Salary=80000;
inc_Salary = ini_Salary * 10/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 4:

ini_Salary=100000;
inc_Salary = ini_Salary * 5/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;

default:
cout"Selected choice is invalid";

}
}

aoa sir error a rha

Angle Bracket " " missing h is lie error h yahn paste sai ni hoga code

CS201_SOL1.txt

ok thnks ho giya ab btiya jo bnie dev wo krana submit ya uska output

CS201 Assignment 1 Solution Spring 2020

Add youtube embed codes here with proper tilte & despriction, otherwise your youtube will be deleted & your account will be banned. Always add the youtube embed codes in discussion replies, as not start a new discussion. Thanks for understanding.

#CS201 solution

cs201%20solution.cpp

## -CS201 ASSIGNMENT NO.1 SOLUTION SPRING 2020-

#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;
}

CS201 Introduction to Programming Assignment 1 Solution & Discussion Spring 2020

Solution Idea:

//program calculate net pay on the basis of increrment, tax deduction on the basis of net salary
#include <iostream>
using namespace std;

main()
{
//delare and initialize the variables
int payScale=0;
int ini_Salary=0;
int inc_Salary=0;
int upd_Salary=0;
int tax_Deduction=0;
int net_Salary=0;

cout"************* SALARY CALCULATOR ***************"endl;
cout"\n************* ***************** ***************"endl;
cout"\n************* Enter 1 for SPS6 ***************"endl;
cout"\n************* Enter 2 for SPS7 ***************"endl;
cout"\n************* Enter 3 for SPS8 ***************"endl;
cout"\n************* Enter 4 for SPS9 ***************"endl;
cout"\nSelect a pay scale from the menue : ";
cin>>payScale;

//switch statement
switch (payScale)
{
case 1:

//calculation
ini_Salary=40000;
inc_Salary = ini_Salary * 20/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 2:
ini_Salary=60000;
inc_Salary = ini_Salary * 15/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 3:

ini_Salary=80000;
inc_Salary = ini_Salary * 10/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;
case 4:

ini_Salary=100000;
inc_Salary = ini_Salary * 5/100;
upd_Salary = ini_Salary + inc_Salary;
tax_Deduction = upd_Salary * 3/100;
net_Salary = ini_Salary + inc_Salary - tax_Deduction;

//display result
cout " Initial Salary: " ini_Salaryendl;
cout " Incremented Salary: " inc_Salaryendl;
cout " Increased Salary: " upd_Salaryendl;
cout " Tax Deduction: " tax_Deductionendl;
cout " Net Salary: " net_Salaryendl;

break;

default:
cout"Selected choice is invalid";

}
}

1

2

3

4

5

## Latest Activity

33 minutes ago
Asad waqas joined + M.Tariq Malik's group

### ENG101 English Comprehension

33 minutes ago
D\$OuLoVeRwHeLm€d liked Heart attacker'++!!'s blog post "Itx about"
1 hour ago
1 hour ago
1 hour ago
Hamza Iqbal joined + M.Tariq Malik's group

### CS202 Fundamentals of Front End Development

1 hour ago
2 hours ago
2 hours ago
Bilal.Khan posted a discussion

### phy 301 assignment 2 required...

2 hours ago
Bilal.Khan posted a status
"phy 301 assignment 2 required..."
2 hours ago
2 hours ago
2 hours ago