+ Link For Assignments, GDBs & Online Quizzes Solution |
+ Link For Past Papers, Solved MCQs, Short Notes & More |
Lesson: 1 to 8. Switch Statement
Due Date: 01.June.2020
Total Marks: 20
Tags:
+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)
+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)
+ Click Here to Search (Looking For something at vustudents.ning.com?) + Click Here To Join (Our facebook study Group)Please Discuss here about this assignment.Thanks
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)
+ Click Here to Search (Looking For something at vustudents.ning.com?)
+ Click Here to Join (Our facebook study Group)
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;
//Main menu
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";
}
}
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
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 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;
//Main menu
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";
}
}
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com Page with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post