Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

// Qs. Write java program that contains the following 2 classes.
(i) Circle class that contains a radius field and getArea method that calculates its area.Give it a constructor where u pass in the radius.
(ii) TestCircle class which creates an array of 100 circles, each with a a random radius and prints out the sum of the areas , the biggest & smallest areas



class Circle {

private float radius;
public Circle(float r)
{
this.radius=r;
}
public float getArea()
{
return (float)(Math.PI*radius*radius);
}
}

class circle7
{
public static void main(String[] args)
{
Circle circles[]= new Circle[100];
for(int i=0; i<circles.length; i++)
{
circles[i]= new Circle((float)(50*Math.random()));
showAreas(circles);
System.out.println("the sum is"+ areaSum(circles));
System.out.println("the minimum is"+ minArea(circles));
System.out.println("the maximum is"+ maxArea(circles));

}
public static float areaSum(Circle c[])
{
float sum= 0;
for(int i=0; i<c.length; i++)
{
sum+= c[i].getArea();
}
return sum;


}

public static float minArea(Circle c[])
{
float min= c[0].getArea();
for(int i=1; i<c.length; i++)
{
if(c[i].getgetArea()<min)
min= c[i].getArea();
}
return min;

}




public static float maxArea(Circle c[])
{
float max= c[0].getArea();
for(int i=1; i<c.length; i++)
{
if(c[i].getgetArea()>max)
max= c[i].getArea();
}
return max;

}
public static void showAreas(Circle c[])
{
for(int i=0; i<c.length; i++)
{
System.out.println(c[i].getArea());
}


}

}


// Can someone plz find the errors in the program? Cuz the compiler is giving 8 errors.
write a java application to calculate the exponent value of a number using the following specifications:
.prompt the user to enter an interger value
.pass the interger value to the method square, which squares the number and to a method cubes the number. The result must be returned to the main method.
The main method must print the results along with a suitable message
Hello! How can I measure time of executing of this program? Thanks!

package hanoi;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
final byte size = 35;
Tower t = new Tower(size);
t.MoveTower(size, 1, 3, 2);
System.out.println(t.getSteps());
System.out.println(Math.pow(2, size) - 1);
}

}
Hi, I am using ippages java api and I am thrown an exception of unknown IP or host, can you give advice??
Thanks
develop a program that can be used to do the following
- Display all the available processes on the system (computer)
- Display the system properties (RAM,CPU, ...)
- Shutdown or restart the machine
- Checks whether the machine is connected to internet or not. If connected, it should proceed to list the information about the ip address( ip address, DNS Server address, default get way ....)
- Lauch applications through your program (begin with ms word and MS excel)
- Make a directory

Design consideration:
You can use a number (or letters/strings) to control the interactivity of your program—e.g Enter 1 to shutdown machine, 2 to display system properties ...)
Design and implement an application that performs flashcard testing of simple mathematical problems. Allow the user to pick the category. Repetitively display a problem and get the user’s answer. Indicate whether the user’s answer is right or wrong for each problem, and display an ongoing score.
Does quicksort use more comparisons than merge sort? Why is it faster if it uses more comparisons?
Design and implement an application that draws the graph of the equation ax² + b + c, where the values of a, b, and c are set using three sliders.
You are to write a program to compute grades for computing program. Your program
should perform the following;
1. Accept input (in marks) from users
2. Calculate final mark taking into account exam and incourse marks as follows;
a. System must prompt the user for one’s name, student id, exam and incourse
marks. [You may assume the weightage for exam and incourse is 50%
respectively]
b. Display final mark (see 3(b) for other conditions)
3. Display final grade
a. The possible grades are:
0 <= average mark < 50 - NN
50 <= average mark < 60 - PA
60 <= average mark < 70 - CR
70 <= average mark < 80 - DI
80 <= average mark <= 100 - HD
b. A student would have failed if marks obtained is less than 50 for either the exam
or incourse component in which case the final mark for the student would be the
lower of the two.
Example:
Exam Mark (%): 40
Incourse Mark (%): 60
Final Mark (%): 40
Having trouble writing a multiplication method that returns a result when passed
Polynomial multiplicationResult = polynomial1.times(polynomial2);

my addition code works which is posted before it accepts inputer from
Polynomial AdditionResult = polynomial1.add(polynomial2);
LATEST TUTORIALS
APPROVED BY CLIENTS