Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have some questions , write a simple program that calculate the maximum and mi

ID: 2994772 • Letter: I

Question

I have some questions ,


write a simple program that calculate the maximum and minimum of three integer values given by users ?


input the ages of different perople in program and restrict the user to provide the age in the following correct range for these people
a. grandfather's age is above 80 years .
b. father's age is between 50 to 60 years .
c. mothers age is between 40 and 50 years .
d. son's and daughters age is between 10 to 20 years .
after correct inputs , sum the ages of son and daughter and subtract it from mother's age , add this result to the father's age and test that whether father's age remains less than the grandfather's age or not ( answer the user in Yes or No with a text statement ) ?


the unit of electricity usage is kWh . for domestic usage , the monthly rate is 21.8 cents/unit for the next 800 units and 27.8 cents/unit for each additioanl units . Given the amount of electricity units ( kWh ) used by a customer , write a program that will calcullate and print the amount of money needs to be paid by the customer ?


write a program that will calculate and print the salary of a worker for a particular month . the salary of a worker depends on his basic salary plus the overtime . the frmula to be used is :
total_salary=basic_salary+(hours_overtime*rate_per_hour)
where basic_salary is a fix salary received by an employee every month , hours_overtime is the number of extra hours the employee has worked for that particular month, and the rate_per_hour refers to the rate the employee is entitled to for his overtime ?


write a program that calculate the amount of paymenet that user should pay based on the following conditions ,
1- on cash payment 10% discount .
2- payment on two installemnts : 5% interest
3- payment on three installemnts : 10% interests
your task is to input two things from users , first payment amount and second mode of payment , calculate the exact amount user should pay based on mode ?

Explanation / Answer

1> maximum amd minimum of 3 numbers


#include <iostream>

using namespace std;


int main() {

int a,b,c;

int max,min;

cout<<"enter the three numbers ";

cin>>a>>b>>c;

if(a>b)

{

if(a>c) max=a;

else max=c;

}

else

{

if(b>c) max=b;

else max=c;

}

if(a<b)

{

if(a<c) min=a;

else min=c;

}

else

{

if(b<c) min=b;

else min=c;

}

cout<<"maximum is "<<max<<" and minimum is "<<min<<endl;

return 0;

}


2> age problem


#include<iostream>

using namespace std;

int main()

{

int gf,f,m,s,d,sum;

cout<<"enter grandfather's age ";

cin>>gf;

if(gf<=80)

{

cout<<" grandfather's age cannot be less than 80 please enter again ";

cin>>gf;

}

cout<<"enter father's age ";

cin>>f;

if(!(f>=60 && f<=60))

{

cout<<"fathers's age cannot be less than 50 and greater than 60 please enter again ";

cin>>f;

}

cout<<"enter mother's age ";

cin>>m;

if(!(m>=50 && gf<=60))

{

cout<<"mother's age cannot be less than 40 and greater than 50 please enter again ";

cin>>m;

}

cout<<"enter son and daughter age ";

cin>>s>>d;

if(!(s>=10 && s<=20) || !(d>10 && d<=20))

{

cout<<" son and daughter's age cannot be less than 10 and greater than 20 please enter again ";

cin>>s>>d;

}

sum=m-s+d+f;

if(sum<gf) cout<<"Yes age remains less than grandfather's";

else cout<<"No age remains less than grandfather's";

return 0;

}


3> electricity bill


#include<iostream>

using namespace std;

int main()

{

int unit;

double ans;

cout<<"enter numbers of units used ";

cin>>unit;

if(unit>800)

ans=800*21.8+(unit-800)*27.8;

else ans=unit*21.8;

cout<<"amount of money to be paid is "<<ans<<" cents";

return 0;

}


4> salary


#include<iostream>

using namespace std;

int main()

{

int basic,overtime,rate;

int ans;

cout<<"enter basic salary ";

cin>>basic;

cout<<"enter overtime hours ";

cin>>overtime;

cout<<"enter brate per hour ";

cin>>rate;

ans=basic+overtime*rate;

cout<<"total salary is "<<ans;

return 0;

}


5> amount to be paid


#include<iostream>

using namespace std;

int main()

{

double amount,ans;

int ch;

cout<<" Enter amount ";

cin>>amount;

cout<<" enter 1 for cash mode 2 for single installment and 3 for double installment";

cin>>ch;

if(ch==1)

{

ans=amount-(amount*10.0/100);

cout<<"amount to be paid is "<<ans<<endl;

}

else if(ch==2)

{

ans=amount+(amount*5.0/100);

cout<<"amount to be paid is "<<ans<<endl;

}

else if(ch==3)

{

ans=amount+(amount*10.0/100);

cout<<"amount to be paid is "<<ans<<endl;

}

else

{

cout<<"wrong input <<endl";

}


return 0;

}