9. The Area of a Rectangle = L * W, where L=length and W=width. Make a program that will input Length and Width, compute and display the Area. Your program will be terminated to have an option to quit processing another entry.
Salary rate/year Tax Percentage deduction
Lesser than 500,000.00 10%
500,000.00 25%
501,000.00 and above 30%
Make a program that will input salary (for one year, Check the salary rate at what range it belongs, process the tax deduction and display the tax amount. Your program will be terminated when you input zero in the salary.
Ex. Salary: 450000.00
Tax deduction amount: 45000.00
#include<iostream>
using namespace std;
int main(){
int l, w;
int x;
do{
cout<<"Enter the width: "<<endl;
cin>>l;
cout<<"Enter the length: "<<endl;
cin>>w;
cout<<"The area of rectangle is: "<<l * w<<endl;
cout<<"Enter 2 to stop the program or 1 to continue \n"<<endl;
cin>>x;
} while(x !=2);
}
#include<iostream>
using namespace std;
int main(){
int salary;
int x;
do{
cout<<"Enter the salary: \n";
cin>>salary;
if(salary<500000){
cout<<"Tax deduction amount: "<<salary * 0.1<<endl;
}
else if(salary==500000){
cout<<"Tax deduction amount: "<<salary * 0.25<<endl;
}
else if(salary>500000){
cout<<"Tax deduction amount: "<<salary * 0.3<<endl;
}
cout<<"Enter 2 to stop the program or 1 to continue \n"<<endl;
cin>>x;
} while(x !=2);
}
Comments
Leave a comment