40 points question please solve all orherwise answer is reported don't spam
otherwise promise answer is reported
Answers
Question:
Write the programs for following:
(a) Calculate the area and perimeter of a rectangle.
(b) Calculate the area and circumference of a circle.
(c) Calculate S.I. and C.I.
(d) Convert Fahrenheit to degree Celsius.
Answer:
(a)
import java.util.*;
public class Rectangle
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
float l,b,a,p;
System.out.println("Enter the length");
l=in.nextFloat();
System.out.println("Enter the breadth");
b=in.nextFloat();
a=(l*b);
System.out.println("The area of the rectangle is ="+a);
p=2*(l+b)
System.out.println("The perimeter of the rectangle is ="+p);
}
}
(b)
import java.util.*;
public class Circle
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
float r,a,c;
System.out.println("Enter the radius");
c=in.nextFloat();
a=(22/7)*Math.pow(r,2);
System.out.println("The area of the circle is ="+a);
c=2*(22/7)*r;
System.out.println("The circumference of the circle is ="+c);
}
}
(c)
import java.util.*;
public class Interest
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int p;
float s,c,a,r,t;
System.out.println("Enter the principal");
p=in.nextInt();
System.out.println("Enter the rate of interest");
r=in.nextFloat();
System.out.println("Enter the time");
t=in.nextFloat();
s=(p*r*t/100);
System.out.println("The S.I. is ="+s);
a=p*Math.pow((r/100),t);
c=(a-p);
System.out.println("The C.I. ="+c);
}
}
(d)
import java.util.*;
public class Temperature
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
float f,c
System.out.println("Enter the temperature in Fahrenheit");
f=in.nextFloat();
c=(f-32)*5/9;
System.out.println("The temperature in Celsius is ="+c);
}
}
For more java programmings follow the given links as I have answered earlier:
https://brainly.in/question/16088835
brainly.in/question/16091640