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

1. Write a program to output the area of a rectangle, circle, and triangle. Ask

ID: 3828141 • Letter: 1

Question

1. Write a program to output the area of a rectangle, circle, and triangle. Ask the user which is desired, ask the parameters needed to compute the results. Allow the user to continue inputting requests until he/she tells the program to stop.

2.

Write a program to calculate a table of loan payments like the one below. Ask the user for the minimum amount of the loan and the minimum interest rate. Output a table that has 5 loan amounts in $10000 increments and 4 interest rates in .25% increments. Use this formula to calculate each Payment, where Principle is loan amount, Rate is interest rate, and Years is length of loan


(Principle*pow((1.0+(Rate/1200.0)),(Years*12.0))*(Rate/1200.0))/(pow((1.0+(Rate/1200.0)),(Years*12.0))-1.0);

C++

Explanation / Answer

1)#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr(); //to clear the screen
float a,b,c,s,r,area;
int ch;
cout<<“***Menu***n1.Area of circlen2.Area of Rectangle”;
cout<<“n3.Area of trianglenEnter your choice:”;
cin>>ch;

switch(ch)
{
case 1:
{
cout<<“nEnter radius of the circle:”;
cin>>r;
area=3.14*r*r;
break;
}
case 2:
{
cout<<“nEnter length and breadth:”;
cin>>a>>b;
area=a*b;
break;
}
case 3:
{
cout<<“nEnter three sides of the triangle:”;
cin>>a>>b>>c;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
break;
}
default: cout<<“nWrong choice…!!!”;
break;
}

cout<<“Area=”<<area;
getch(); //to stop the screen
}