Math, asked by Questioneriorr, 1 month ago

JAVA - Computer.
1. Write a program that calculates sum of four numbers 7.9, 2.3, 8.8 and 13.5
2. Write a program how to calculate area of sphere with radius 7 cm.
3. Write a program to calculate volume of sphere whose radius is 7 cm.​

Answers

Answered by debarunbanerjee1205
4

Answer:

1. class numbers{

public static void main(String args[]){

double a=7.9+2.3+8.8+13.5;

System.out.println(a);

    }

}

2.class sphere{

public static void main(String args[]){

double a=4*(22/7)*7*7;

System.out.println(a);

    }

}

3. class volume{

public static void main(String args[]){

double a=(4/3)*(22/7)*7*7;

System.out.println(a);

    }

}

pls mark my answer as the brainliest if it helped.

Answered by Ladylaurel
23

Required Answer :-

1. Write a program that calculates sum of four numbers 7.9, 2.3, 8.8 and 13.5.

Solution :-

public class Sum

{

public void Add()

{

double num1 = 7.9, num2 = 2.3, num3 = 8.8, num4 = 13.5;

double sum = num1 + num2 + num3 + num4;

System.out.println("The four numbers are:" + num1);

System.out.println("," + num2);

System.out.println("," + num3);

System.out.println("," + num4);

System.out.println("The sum is" + sum);

}

}

Output :-

The four numbers are: 7.9, 2.3, 8.8, 13.5

The sum is 32.5

ㅤㅤㅤㅤㅤㅤ___________________

2. Write a program how to calculate area of sphere with radius 7 cm.

Solution :-

public class SurfaceArea

{

public void calcArea()

{

int r = 7;

double area, volume, pi = 3.14159;

System.out.println("The radius of sphere:" + r);

area = 4*pi*r*r;

System.out.println("The surface of sphere:" + area);

}

}

Output :-

The radius of sphere: 7

The surface area of sphere: 615.75164

ㅤㅤㅤㅤㅤㅤ____________________

3. Write a program to calculate volume of sphere whose radius is 7 cm.

Solution :-

public class Volume

{

public void clacVolume()

{

double area, volume, pi = 3.14159;

System.out.println("Radius of sphere:" + r);

volume = 4/3*pi*r*r*r;

System.out.println("The volume of sphere:" + volume);

}

}

Output :-

Radius of sphere: 7

Volume of sphere: 1436:7538266666666

ㅤㅤㅤㅤㅤㅤ____________________

Similar questions