Question

In: Computer Science

I want Algorithim of this c++ code #include<iostream> using namespace std; int main() { char repeat...

I want Algorithim of this c++ code

#include<iostream>

using namespace std;

int main()

{

char repeat = 'y';

for (;repeat == 'y';){

char emplyeename[35];

float basic_Salary,EPF, Dearness_Allow, tax, Net_Salary , emplyee_id;

cout << "Enter Basic Salary : ";

cin >> basic_Salary;

Dearness_Allow = 0.40 * basic_Salary;

switch (01)

{case 1:

if (basic_Salary <= 2,20,00)

EPF = 0;

case 2:

if (basic_Salary > 28000 && basic_Salary <= 60000)

EPF = 0.08*basic_Salary;

case 3:

if (basic_Salary > 60000 && basic_Salary <= 200000)

EPF = (0.17)*(basic_Salary - 60000) + 22300;

Net_Salary = basic_Salary + Dearness_Allow - EPF;

cout<<"Employee Id       : ";

cin>>emplyee_id;

cout<<"Employee Name     : ";

cin>>emplyeename;

cout<<"EPF               : "<<EPF<<endl;

cout<<"Dearness Allow     : "<<Dearness_Allow<<endl;

cout<<"Net Salary        : "<<Net_Salary<<endl;

cout<<"Do you want to still continue....Yes/No "<<endl;

cin>>repeat;}}

return 0;}

Solutions

Expert Solution

//Algorithm

1.Start

2. Assign repeat = 'y'

3. do the steps 3 .1 to 3.13 until (repeat equal to 'y')

                3.1 input "Enter Basic Salary : ", basic_Salary

                3.2 Dearness_Allow = 0.40 * basic_Salary

                3.3 if (basic_Salary <= 2,20,00) then EPF = 0;

                3.4 if (basic_Salary > 28000 and basic_Salary <= 60000) then EPF = 0.08*basic_Salary

                3.5 if (basic_Salary > 60000 and basic_Salary <= 200000) then

                                EPF = (0.17)*(basic_Salary - 60000) + 22300

                3.6 Net_Salary = basic_Salary + Dearness_Allow - EPF

                3.7 Input "Employee Id       : ",emplyee_id

                3.8 Input "Employee Name     : ",emplyeename

                3.9 Display "EPF               : ",EPF

                3.10 Display "Dearness Allow     : "Dearness_Allow

                3.11 Display "Net Salary        : ",Net_Salary

                3.12 Display "Do you want to still continue....Yes/No "

                3.13 Input repeat

4.Stop

Screen shot of the algorithm

Please comment if any query


Related Solutions

write the algorithm for this the code?!. #include<iostream> using namespace std; #include<string.h> int main() { char...
write the algorithm for this the code?!. #include<iostream> using namespace std; #include<string.h> int main() { char plain[50], cipher[50]="", decrypt[50]=""; int subkeys[50], len;       cout<<"Enter the plain text:"<<endl; cin>>plain;    cout<<"Enter the first subkey:"<<endl; cin>>subkeys[0];    _strupr(plain);    len = strlen(plain);    /**********Find the subkeys**************/    for(int i=1; i<len; i++) { if ((plain[i-1]>='A') && (plain[i-1]<='Z')) { subkeys[i] = plain[i-1]-65; } }    /****************ENCRYPTION***************/       for(int i=0; i<len; i++) { if ((plain[i]>='A') && (plain[i]<='Z')) {    cipher[i] = (((plain[i]-65)+subkeys[i])%26)+65; }...
C++ Given Code: #include <iostream> #include <string> using namespace std; int main() { //declare variables to...
C++ Given Code: #include <iostream> #include <string> using namespace std; int main() { //declare variables to store user input bool cont = true; //implement a loop so that it will continue asking until the user provides a positive integer // the following provides ONLY part of the loop body, which you should complete { cout <<"How many words are in your message? \n"; cout <<"Enter value: "; // get user input integer here    cout <<"\nInvalid value. Please Re-enter a...
What would the following program output? #include <iostream> using namespace std; int main() { char alpha...
What would the following program output? #include <iostream> using namespace std; int main() { char alpha = 'A'; for(int i = 0; i < 13; i++){ for(int j = 0; j < 2; j++){ cout << alpha; alpha++; } } cout << endl; return 0; }
I want flowchart process for this code c++ _____________________ #include<bits/stdc++.h> using namespace std; int main() {...
I want flowchart process for this code c++ _____________________ #include<bits/stdc++.h> using namespace std; int main() { char repeat = 'Y'; for (;repeat == 'Y';){ char empname[222]; float basicSalary, h_r_a, DearnessAllow, tax, netSalary; int e_id; cout<<"\nEmployee Name :"; cin>>empname; cout<<"\nEmployee Id :"; cin>>e_id; cout << "Enter Basic Salary : "; cin >> basicSalary; DearnessAllow = 0.30 * basicSalary; h_r_a= 800; switch (1) { case 1: if (basicSalary <= 2,50,000) tax = 0; case 2: if (basicSalary > 250000 && basicSalary <=...
#include <iostream> using namespace std; int main() {     int hour;     int min;     for (hour = 1;...
#include <iostream> using namespace std; int main() {     int hour;     int min;     for (hour = 1; hour <= 12; hour++)     {         for (min = 0; min <= 59; min++)         {             cout << hour << ":" << min << "AM" << endl;         }     }       return 0; } 1.      Type in the above program as time.cpp. Add a comment to include your name and date. Compile and run. 2.      What is the bug or logic error in the above program? Add the...
#include <iostream> #include <iomanip> using namespace std; int main() {     int studentid, numberreverse[20], count =...
#include <iostream> #include <iomanip> using namespace std; int main() {     int studentid, numberreverse[20], count = 0, maximum = 0, minimum = 0;     cout << "Enter your student ID number: ";     cin >> studentid;     cout << "Student ID Number = " << studentid << endl;     while (studentid != 0)     {          numberreverse[count] = studentid % 10;          if (count == 0)          {              minimum = numberreverse[count];              maximum = minimum;          }          else...
#include <iostream> #include <string> #include <fstream> #include <vector> #include <sstream> using namespace std; int main() {...
#include <iostream> #include <string> #include <fstream> #include <vector> #include <sstream> using namespace std; int main() { ifstream infile("worldpop.txt"); vector<pair<string, int>> population_directory; string line; while(getline(infile, line)){ if(line.size()>0){ stringstream ss(line); string country; int population; ss>>country; ss>>population; population_directory.push_back(make_pair(country, population)); } } cout<<"Task 1"<<endl; cout<<"Names of countries with population>=1000,000,000"<<endl; for(int i=0;i<population_directory.size();i++){ if(population_directory[i].second>=1000000000){ cout<<population_directory[i].first<<endl; } } cout<<"Names of countries with population<=1000,000"<<endl; for(int i=0;i<population_directory.size();i++){ if(population_directory[i].second<=1000000){ cout<<population_directory[i].first<<endl; } } } can u pls explain the logic behind this code up to 10 lines pls, many thanks
#include <iostream> #include <stack> #include <queue> using namespace std; void printFromStack(string expr){ stack<char> myStack; for(int i=0;...
#include <iostream> #include <stack> #include <queue> using namespace std; void printFromStack(string expr){ stack<char> myStack; for(int i=0; i<expr.length(); i++){ //Insert code here to push each character onto the stack } cout << "My stack is popped in this order" << endl; while(!myStack.empty()){ //Insert code here to cout the top of the stack one by one //Pop each one after it’s printed out } cout << endl; } void printFromQueue(string expr){ queue<char> myQueue; //Insert code here to push each character onto the...
***Convert the C++ to Python*** #include <iostream> using std::cout; using std::cin; using std::endl; int charClass; char...
***Convert the C++ to Python*** #include <iostream> using std::cout; using std::cin; using std::endl; int charClass; char lexeme[100]; char str[200]; char nextChar; const int LETTER = 0; const int DIGIT   = 1; const int UNKNOWN = -1; const int OPAREN = 2; const int CPAREN = 3; const int PLUS = 4; const int MINUS = 5; const int MUL = 6; const int DIV = 7; const int ID_CODE = 100; const int PLUS_CODE = 101; const int MINUS_CODE =...
C++ I took 7/20 =( code: #include <iostream> #include<string.h> using namespace std; // function to calculate...
C++ I took 7/20 =( code: #include <iostream> #include<string.h> using namespace std; // function to calculate number non white space characters int GetNumOfNonWSCharacters(string str) { int i = 0; int count = 0; while(str[i] != '\0') { if(str[i] != ' ') { count += 1; } i++; } return count; } // function to calculate numbers of words int GetNumOfWords(string str) { int i = 0; int count = 1; while(str[i] != '\0') { if(str[i] == ' ' && str[i-1]...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT