(Solved) : Rewrite Three Programs Homework 4 Convert C C Execute Programs Switch Else Statement Menu Q42766465 . . .

Rewrite the three programs from homework #4 and convert them from C++ to C. Execute the programs in a switch or if else state

These are the 3 programs that needs to beconverted

1 #include <iostream> 3 using namespace std; 8 5 int main() 6 { 7 double retroActivePay; double NewAnnualSalary; double NewMo

1 #include <iostream> 2 using namespace std; 4 int main() 5 { int year; cout << Enter yearn; cin >> year; if(year%4==0||(y

1 #include <iostream> 2 using namespace std; 4 int main() { int count=0; int number; cout << Enter even numbers, type o to

Rewrite the three programs from homework #4 and convert them from C++ to C. Execute the programs in a switch or if else statement with a menu similar to that listed below. Include checking for an invalid menu option. Also, use a loop to execute the program until the user decides to quit. To quit the program, exit(0) can still be used. Each program should be executed in a function based on the menu choice. Function prototypes are listed below. Save the source file as lastName.c .c is the extension for C language). Remember the things to convert, #<iostream> becomes #include<stdio.h>, cout becomes printf() and cin becomes scanf(). The rest of the program should remain the same. The first program conversion was given in class, and will work as an example of converting the syntax from C++ to C. 1) Calculate Retroactive Pay 2) Determine leap year 3) Count even numbers entered 4) Quit Make a choice to execute program: Function Prototypes: void calcRetroPay(float annualSalary); void leap Year(int year); void evenNumbers(); 1 #include <iostream> 3 using namespace std; 8 5 int main() 6 { 7 double retroActivePay; double NewAnnualSalary; double NewMontlySalary: 10 double UserInput; cout << “Enter the employee salary:n”; cin >> UserInput; 13 14 16 cout << ” After the Salary increase”; retroActivePay = 221.67*6; NewAnnualsalary = UserInput*0.076: NewAnnualSalary = NewAnnualSalary + UserInput; NewMontlysalary = (UserInput/12) + 221.66; 18 19 22 cout << endl; cout << “Retro Active Pay: ” << “$” << retroActivePay; cout << endl; cout << “New Annual Salary: ” << “$” << NewAnnualSalary: cout << endl; cout << “New Montly Salary: ” << “$” << NewMontlysalary; cout << endl; 28 return 0; 29 } 30 1 #include <iostream> 2 using namespace std; 4 int main() 5 { int year; cout << “Enter yearn”; cin >> year; if(year%4==0||(year%400==0&&year%100!=0)), 10 11 cout << “leap year”; 12 13 else 14 15 cout << “not a leap year”; 26 2 return 0; 19 } 20 1 #include <iostream> 2 using namespace std; 4 int main() { int count=0; int number; cout << ” Enter even numbers, type o to exit”; cin >> number; while (number>e) OOONOVOU if (number%2==0) count = count+1; cout << “Enter even numbers, type o to exit “; cin >> number; cout << endl; 24 cout << ” The number of even numbers are: ” << count; 25 } Show transcribed image text Rewrite the three programs from homework #4 and convert them from C++ to C. Execute the programs in a switch or if else statement with a menu similar to that listed below. Include checking for an invalid menu option. Also, use a loop to execute the program until the user decides to quit. To quit the program, exit(0) can still be used. Each program should be executed in a function based on the menu choice. Function prototypes are listed below. Save the source file as lastName.c .c is the extension for C language). Remember the things to convert, # becomes #include, cout becomes printf() and cin becomes scanf(). The rest of the program should remain the same. The first program conversion was given in class, and will work as an example of converting the syntax from C++ to C. 1) Calculate Retroactive Pay 2) Determine leap year 3) Count even numbers entered 4) Quit Make a choice to execute program: Function Prototypes: void calcRetroPay(float annualSalary); void leap Year(int year); void evenNumbers();
1 #include 3 using namespace std; 8 5 int main() 6 { 7 double retroActivePay; double NewAnnualSalary; double NewMontlySalary: 10 double UserInput; cout UserInput; 13 14 16 cout

Expert Answer


Answer to Rewrite the three programs from homework #4 and convert them from C++ to C. Execute the programs in a switch or if else …

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us