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
An organization has a website with a guest book feature, where visitors to the web site can input their names and comments about
kozerog [31]

Answer:

B

Explanation:

6 0
3 years ago
Read 2 more answers
In one week, your company received the following quantities of e-mail messages. Monday 240 Tuesday 315 Wednesday 290 Thursday 18
Vika [28.1K]

Answer:

280

Explanation:

Average = (240 + 315 + 290 + 180 + 375) ÷ 5

= 1400 ÷ 5

= 280

Cheers

3 0
3 years ago
Which are types of lines? Choose three answers.
alekssr [168]
Straight
Curvilinear
Rectilinear
7 0
3 years ago
What is basically the only thing that computers (microprocessors and prgrammable devices) understand?
horsena [70]

Answer:

Binary Code

Explanation:

All microprocessors and programmable devices understand is Binary Code. These are various combinations of 0's and 1's which when placed together in a sequence represent a set of instructions that the microprocessor can read and understand to complete complex tasks. There are various other programming languages to program these tasks in an easier to read syntax for the programmers themselves but they simply take the written code and convert it into Binary before sending it to the microprocessor.

4 0
3 years ago
WILL MARK BRAINLIEST AND 20 POINTS
Fantom [35]
With templates, you can Create a new document based on previous formatting, create a custom template for future use, and apply different templates to different pages of a document.
4 0
3 years ago
Other questions:
  • If you enter 234.567 into a cell that is formatted to display 1 decimal point place, what is the value stored in the cell
    9·1 answer
  • What is the top folder of the file tree called
    5·2 answers
  • How many cells does the organism have?\
    5·2 answers
  • What is online school like 6 sentences
    12·1 answer
  • Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
    11·1 answer
  • A _____ object is the instance of a class that receives a request from another object. Select one: a. client b. server c. contra
    5·1 answer
  • The term that refers to the standard computer language for creating web pages is called:
    6·1 answer
  • State three advantages of using a printer​
    15·1 answer
  • Samuel was hired to create a program that asks the user questions and, based on the answers, recommend a book to read. What kind
    8·1 answer
  • If “A” represents in binary 10011001, what will be the value of word “CAB”?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!