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 toolbar is located next to the office button and contain the commonly used commands​
Andrei [34K]

Answer: Quick Access Toolbar

The Quick Access Toolbar is located to the right of the Microsoft Office Button . It contains commands that are used most often, for example Redo, Undo and Save.

Explanation:

7 0
3 years ago
Audience centered public speakers are inherently sensitive to the
DanielleElmas [232]
Diversity of their audiences
7 0
2 years ago
Read 2 more answers
How were images captured before the invention of the camera?
xeze [42]

Answer:

The British inventor Fox Talbot produced his first successful photographic images in 1834, without a camera, by placing objects onto paper brushed with light-sensitive silver chloride, which he then exposed to sunlight.

Explanation:

5 0
2 years ago
Communication among office computers is based on a protocol that uses CRC-32 for error detection. A series of 100 identical test
Fiesta28 [93]
I think it is the CRC-32 for error detection
4 0
2 years ago
Discuss any five positive and five Negative impact<br>of ICT on society​
mojhsa [17]

Answer:

The technology of information communication has the capacity to transform society. It plays a key part and provides the infrastructure needed to achieve each of the United Nations Sustainable Development Goals. It also allows financial integration by m-commerce and lets people connect instantly to millions.

ICT has a particularly important impact on business. It allows people to exchange knowledge and advice immediately and establish a website or online shop at a low cost, thus reducing the obstacles to starting a business dramatically. As such, it is a major factor in change and the maturity of ICTs is strongly connected to economic growth.

Explanation:

Effects of ICT

As a human beings, we are always associated in our everyday life with many essential things. The use of ICT equipment in our lifestyle has simplified many time-consuming calculations and difficult tasks, and social contacts have been strengthened. ICT has affected life by enhancing the timely distribution of media information and improved home and workplace communications via social networking, e-mail, etc.

The quality of human life has been greatly improved by ICT. For example, it could take a few days for a letter to come to the recipient, but a single minute for an e-mail to reach. ICT offers a broader understanding and information for each facility  24 Hrs X 7 days. In the following, ICT affects different fields of daily living.

Positive Impacts of ICT:

  • As domestic and home businesses.
  • As social connectivity.
  • As E-learning/ As education
  • As for shopping/trading
  • As for banks
  • As a job/jobs

Negative Impacts of ICT:

  • Face-to-face interaction reduced.
  • Social Decoupling.
  • Physical activity/health issues reduced.
  • Cost.

4 0
2 years ago
Other questions:
  • In a two-sided tag, a(n) ____ tag indicates the content's end.
    7·2 answers
  • List the data types that are allowed for SQL attributes.
    7·1 answer
  • Scratch and grinding marks on sedimentary rocks indicate which type of environment?
    6·1 answer
  • Eight what makes one character
    14·1 answer
  • Who began digitizing books on a massive scale and putting them online?
    8·1 answer
  • During a network infrastructure upgrade, you have replaced two 10 Mbps hubs with switches and upgraded from Category 3 UTP cable
    6·1 answer
  • Conclusion for primary memory
    15·1 answer
  • Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
    10·1 answer
  • Use python
    9·1 answer
  • Five types of conflict in the school​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!