Professional Documents
Culture Documents
Task 1: To calculate the area and circumference of circle by giving the value of radius
through commandline in meter use math functions where needs.
import java.util.Scanner;
class task31
Task 2: To solve the quadratic equation and display the two real roots x1 and x2. The three
inputswill be given through command line use math functions where needs.
import java.util.Scanner;
class task32
double a = input.nextDouble();
double c = input.nextDouble();
if(det>0)
else if(det==0)
double root1=-b/(2*a);
else
System.out.format("root1=%.2f+%.2fi",real,imaginary);
System.out.format("\nroot2=%.2f-%.2fi",real,imaginary);
Task 3: To roll a dice and generate a general number from 1 to 6 and display that random
numberuse math functions where needs.
import java.util.Random;
class task33
{
public static void main(String args[])
int number;
for(int counter=1;counter<=10;counter++)
number=1+dice.nextInt(6);
System.out.println(number+ "");
Task 4: To Find the following Angle Functions using Math functions collected input from user
byCommand Line Input ( Sin(), Cos(), Tan(), )
import java.util.Scanner;
class task34
System.out.println();
System.out.println();
System.out.println();
System.out.println();