Computer Science, asked by rocky364, 11 months ago

40 points question please solve all orherwise answer is reported don't spam



otherwise promise answer is reported ​

Attachments:

Answers

Answered by Anonymous
2

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

Answered by humera98765
0

The perimeter is the length of the outline of a shape. To find the perimeter of a rectangle or square you have to add the lengths of all the four sides. x is in this case the length of the rectangle while y is the width of the rectangle.

To find the circumference, you double the radius and multiply by pi. To find the area, you square the radius and multiply by pi. How do I find the diameter of a circle whose area is 28.26? Divide the area by pi: that's the square of the radius

Similar questions