1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reika [66]
3 years ago
8

The calcCircleCircumf() method invoked within in the CircleStatsTester class is overloaded. Write the overloaded methods in the

incomplete public CircleStats class.
public class CircleStats
{
public CircleStats()
{
}

//…code goes here — use the Math constant for pi rather than 3.14
}

public class CircleStatsTester
{
public static void main(String[] args)
{

int diameter = 5;
double radius = 2.5;
CircleStats cStats = new CircleStats();

System.out.println("The circumference = " + cStats.calcCircleCircumf(diameter));
System.out.println("The circumference = " + cStats.calcCircleCircumf(radius));

}
}
Computers and Technology
1 answer:
solong [7]3 years ago
7 0

Answer:

The program to this question as follows:

Program:

class CircleStats //defining class  

{

CircleStats() //creating default constructor

{

}

float calcCircleCircumf(float radius) //defining method  

{

   return (float)(2 * Math.PI * radius); //return value

}

double calcCircleCircumf(double diameter) //overload the method

{

   return (2 * Math.PI * (diameter/2)); //return value

}

}

public class CircleStatsTester //defining class  

{

public static void main(String ar[]) //defining main method  

{

int diameter = 5; //defining integer variable

double radius = 2.5;//defining float variable

CircleStats cStats = new CircleStats(); //creating CircleStats class object

System.out.println("The circumference = " + cStats.calcCircleCircumf(diameter)); //print value

System.out.println("The circumference = " + cStats.calcCircleCircumf(radius));  //print value

}

}

Output:

The circumference = 31.4

The circumference = 7.853981633974483

Explanation:

In the above java program code, two-class is declared that are "CircleStats and CircleStatsTester". In the class "CircleStats" a default constructor is created then method overloading is performed in which two method is defined that have the same name but different parameters.

  • In the first-time method declaration, it contains a float variable "radius" in its parameter to calculate and return its value.
  • In the second time method declaration, it contains a double variable "diameter" in its parameter, calculates and returns its value.

Then another class CircleStatsTester is defined inside this class the main method is defined. In the main method, an integer and double type variable is defined that contains a value that is "diameter = 5 and radius = 2.5". In this method, an above class CircleStats object is created and call this class functions.

You might be interested in
Which of the selection below does not represent a workable IP address?
gogolik [260]

Answer:

ipv4 ip addresses will be 4 sets of numbers to a maximum of 255 per set ie the highest ipv4 number is 255.255.255.255 ipv6 use hexadecimal and has many more addresses ie ipv6 0:0:0:0:0:ffff:ffff:ffff is = to ipv4  255.255.255.255

Explanation:

8 0
3 years ago
A national tax preparation firm is accessing industry-specific productivity applications in the cloud; many other tax preparatio
Andreas93 [3]

Answer:

software as a service(SaaS) model

Explanation:

This is because the software applications are accessed over the internet meaning no need for infrastructure installation and maintenance.

8 0
3 years ago
A researcher develops a new instrument to measure coping skills and conducts a pilot study to compare the new tool with an exist
alexira [117]

Answer:b)convergence.

Explanation: Convergence has the basic meaning as when two or more unit of anything meet to converge or join. In the research , the different types of the tools are brought togather and skills and compare them.The measurement is done through the tools which has the already defined parameters.

Thus this concept is the example of the convergence because the tools are being converged and compared.so, the correct answer is option (B) and other option are incorrect because they have the technique of the contrasting and separation and reading respectively.

3 0
3 years ago
Hey good to mett you
ella [17]

Answer:

You too?

Explanation:

4 0
3 years ago
Jennifer turns on her laptop and hears a series of beeps. What do they probably indicate?.
telo118 [61]

Answer:

Bad Ram or CPU/GPU Problems

Explanation:

It depends on the motherboard used in the type of PC you'd have to look up the number of beeps and the time spread out to figure out your certain issue.

3 0
2 years ago
Other questions:
  • Learning about public speaking can help improve your ________________.
    15·1 answer
  • What are two examples of ways an electronic record may be distributed to others?
    15·1 answer
  • A user complains that his new mouse doesn't work right. He has an old system at home and when he has had this problem, he cleane
    11·2 answers
  • Describe some ways that you personally use information technologies differently than you did just a few years ago
    11·1 answer
  • Write an if statement that assigns 100 to x when y is equal to 0.
    7·1 answer
  • Alice and Bob decide to communicate using NTRUEncrypt with parameters (N, p, q) = (7, 3, 29). Alice’s public key is h(x) = 3 + 1
    15·1 answer
  • Who invented Leibnitz calculating machine ?
    12·1 answer
  • Complete the sentence.
    8·1 answer
  • You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re
    8·1 answer
  • What do we call the software which programmers use to program?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!