%3Cp%3ENeed%20answers%20to%20the%20questions%20as%20well.%3C%2Fp%3E%0A%3Cp%3E%3C
ID: 3552128 • Letter: #
Question
%3Cp%3ENeed%20answers%20to%20the%20questions%20as%20well.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EProgramming%20Problem%201%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EWrite%20a%20program%20that%20calculates%20and%20outputs%20the%20monthly%20paycheck%0Ainformation%20for%20an%20employee%2C%20including%20all%20the%20amounts%20deducted%0Afrom%20an%20employee%E2%80%99s%20gross%20pay%2C%20and%20the%20net%20pay%20that%20is%20due%20to%20the%0Aemployee.%20The%20user%20of%20your%20program%20will%20know%20the%20employee%E2%80%99s%20name%0Aand%20the%20gross%20pay%20for%20the%20employee.%20Each%20employee%20has%20the%20following%0Adeductions%20taken%20from%20his%20gross%20pay%3A%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EFederal%20Income%20Tax%3A%2015%25%3C%2Fp%3E%0A%3Cp%3EState%20Tax%3A%203.5%25%3C%2Fp%3E%0A%3Cp%3ESocial%20Security%20%2B%20Medicare%20Tax%3A%208.5%25%3C%2Fp%3E%0A%3Cp%3EHealth%20Insurance%20%2475%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EThe%20output%20from%20your%20program%20should%20be%20structured%20as%20is%0Adisplayed%20below%3A%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EBill%20Robinson%3C%2Fp%3E%0A%3Cp%3EGross%20Amount%3A%20............%20%243575.00%3C%2Fp%3E%0A%3Cp%3EFederal%20Tax%3A%20.............%20%24%20536.25%3C%2Fp%3E%0A%3Cp%3EState%20Tax%3A%20...............%20%24%20125.13%3C%2Fp%3E%0A%3Cp%3ESocial%20Sec%20%2F%20Medicare%3A%20...%20%24%20303.88%3C%2Fp%3E%0A%3Cp%3EHealth%20Insurance%3A%20........%20%24%20%2075.00%3C%2Fp%3E%0A%3Cp%3ENet%20Pay%3A%20.................%20%242534.75%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EYour%20program%20should%20deal%20with%20erroneous%20input%20values.%20Gross%0Asalary%20should%20always%20be%20a%20positive%20number.%20Make%20sure%20that%20you%20deal%0Awith%20the%20possibility%20that%20the%20user%20may%20have%20entered%20a%20non-numeric%0Ainput%20value.%20Have%20your%20program%20output%20appropriate%20error%20messages%20in%0Athese%20cases.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E1.%20Identify%20the%20inputs%20and%20outputs%20of%20the%20problem.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E2.%20Identify%20the%20processing%20needed%20to%20convert%20the%20inputs%20to%20the%0Aoutputs.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E3.%20Design%20an%20algorithm%20in%20pseudocode%20to%20solve%20the%20problem.%20Make%0Asure%20to%20include%20steps%20to%20get%20each%20input%20and%20to%20report%20each%20output.%0AInclude%20steps%20to%20deal%20with%20error%20cases.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E4.%20Identify%20three%20test%20cases%2C%20one%20using%20a%20positive%20number%2C%20and%0Aone%20using%20a%20negative%20number%2C%20and%20one%20using%20incorrect%20input%20(ie.%0AInput%20a%20letter%20rather%20than%20a%20digit%20for%20the%20numeric%20input).%20For%20each%0Aof%20the%20three%20test%20cases%20show%20what%20inputs%20you%20will%20use%20and%20what%20your%0Aexpected%20outputs%20should%20be.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E5.%20Write%20the%20program%20to%20implement%20your%20algorithm.%20Test%20your%0Aprogram%20using%20your%20test%20cases.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EProgramming%20Problem%202%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EIn%20a%20right%20triangle%2C%20the%20square%20of%20the%20length%20of%20one%20side%20is%0Aequal%20to%20the%20sum%20of%20the%20squares%20of%20the%20lengths%20of%20the%20other%20two%0Asides.%20Stephanie%20has%20the%20integer%20lengths%20of%20three%20sides%20of%20a%0Atriangle%20and%20needs%20to%20know%20if%20it%20is%20a%20right%20triangle.%26nbsp%3B%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EWrite%20a%20program%20to%20solve%20this%20problem.%20NOTE%3A%20The%20user%20must%20be%0Aallowed%20to%20input%20the%20values%20of%20the%20sides%20in%20ANY%20ORDER!%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E1.%20Identify%20the%20inputs%20and%20outputs%20of%20the%20problem.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E2.%20Identify%20the%20processing%20needed%20to%20convert%20the%20inputs%20to%20the%0Aoutputs.%26nbsp%3B%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E3.%20Design%20an%20algorithm%20in%20pseudocode%20to%20solve%20the%20problem.%20Make%0Asure%20to%20include%20steps%20to%20get%20each%20input%20and%20to%20report%20each%0Aoutput.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E4.%20Identify%20five%20significant%20test%20cases%20including%20one%20for%0Aincorrect%20input%20(ie.%20Input%20a%20letter%20rather%20than%20a%20digit%20for%20the%0Anumeric%20input).%20(Think%20about%20what%20impact%20changing%20the%20order%20of%20the%0Ainput%20values%20should%20have%20on%20your%20program!)%20For%20each%20of%20the%20five%0Atest%20cases%20show%20what%20inputs%20you%20will%20use%20and%20calculate%20what%20your%0Aexpected%20outputs%20should%20be.%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3E5.%20Write%20the%20program%20to%20implement%20your%20algorithm.%20Test%20your%0Aprogram%20using%20your%20test%20cases.%3C%2Fp%3E%0A%3Cdiv%3E%3Cbr%20%2F%3E%3C%2Fdiv%3E%0A%3Cdiv%3E%3Cbr%20%2F%3E%3C%2Fdiv%3E%0AExplanation / Answer
Programming Problem 1
#include <iostream>
#include<string>
using namespace std;
int main()
{
double grossPay;
double FedralTax;
double StateTax;
double Social_midCare;
double HealthInsurance;
string name;
cout<<"please enter the employee name"<<endl;
getline(cin,name);
cout<<"please enter the gross pay of "<<name<<endl;
cin>>grossPay;
if(grossPay<0)
{
while(grossPay<=0)
{
cout<<"sorry you entered a wrong Gross Pay information"<<endl;
cout<<"please enter the Gross Pay again"<<endl;
cin>>grossPay;
}
}
FedralTax=grossPay*(15.0/100) ;
StateTax=(3.5/100)*grossPay;
Social_midCare=(8.5/100)*grossPay;
HealthInsurance=75;
cout<<name<<endl;
cout<<"Gross Amount: ............ "<<grossPay<<"$"<<endl;
cout<<"Federal Tax: ............. "<<FedralTax <<"$"<<endl;
cout<<"State Tax: ............... "<<StateTax<<"$"<<endl;
cout<<"Social Sec / Medicare: ... "<<Social_midCare<<"$"<<endl;
cout<<"Health Insurance: ........ "<<HealthInsurance<<"$"<<endl;
grossPay=grossPay - (FedralTax + StateTax + Social_midCare + HealthInsurance);
cout<<"Net Pay: ................. "<<grossPay<<"$"<<endl;
}
Programming Problem 2
#include<iostream>
#include<cmath>
using namespace std;
void main()
{
double length1,lenght2,length3;
cout<<"please enter the length of the 3 triangles sides"<<endl;
cin>>length1>>lenght2>>length3;
double try1,try2,try3;
try1=pow(length1,2)+pow(lenght2,2);
try2=pow(length1,2)+pow(length3,2);
try3=pow(lenght2,2)+pow(length3,2);
if(try1== pow(length3,2))
cout<<"this is a right triangle"<<endl;
else if(try2== pow(lenght2,2))
cout<<"this is a right triangle"<<endl;
else if(try3== pow(length1,2))
cout<<"this is a right triangle"<<endl;
else
cout<<"this is not a right triangle"<<endl;
}
Please rate first with 5 star, otherwise i won
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.