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
Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" an
Maurinko [17]

Answer:

yes a computer can evaluate expressions depends on the computer for the maybe expression

Explanation:

4 0
3 years ago
Read 2 more answers
Debugging is not testing, but always occurs as a consequence of testing. <br> A) TRUE<br> B) FALSE
kherson [118]
A) True Hope that helps
5 0
3 years ago
-Define three types of user mode to kernel mode transfers?
Ivahew [28]

Answer:

 The three types of user mode to the kernel mode transferred occurred due to the:

  • It is mainly occurred due to the interrupt when, it send to the central processing unit (CPU).
  • It also occurs due to the hardware exception and when the memory is access illegally as it is divided by the zero.
  • It is mainly implemented or executed by the trap instruction as the system are basically executed by the program.
7 0
3 years ago
If userA wants to send a secure message to userB using an asymmetric cryptographic algorithm, which key does userB use to decryp
ANTONII [103]

Answer:

userB will use his/her private key.

Explanation:

The steps involved in using asymmetric cryptographic algorithm are as follow:

1. Each user generates a pair of keys to be used for the encryption and decryption of messages.

2. Each user places one of the two keys in a public register or other accessible file. This is the public key. The companion key is kept private.

3. If UserA wishes to send a confidential message to UserB, UserA encrypts the message using UserB's public key.

4. When UserB receives the message, she decrypts it using her private key.

4 0
3 years ago
Differentiate among a color display, gray scale display, and a black-and-white display​
kotykmax [81]

<u>Answer:</u>

<em>Black and white</em>:

It has only two values namely black or white. The white colour in the image will be represented as “white” and other colour part will be displayed as black.

<em>Grey-scale: </em>

Again the white part does not have a change, the black and other coloured items will be displayed in grey.

<em>Coloured image: </em>

It would display the actual colour of the image. The number of colours and shades depends on the original image from where actually it has been shooted and it also depends on the quality of the camera.

4 0
3 years ago
Other questions:
  • 1. The best program to present numerical data in would be ____. a. Access c. PowerPoint b. Excel d. Word
    6·1 answer
  • Which type of market are you in if your firm, along with three other firms, controls 95% of the total music industry?
    13·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    10·1 answer
  • For any two documents x and z, define k(x, z) to equal the number of unique words that occur in both x and z (i.e., the size of
    15·1 answer
  • Businesses use spreadsheets to keep track of financial________.
    14·1 answer
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • You implement basic version control and go through the phase of creating a local repository. Initiate the commands to set up tha
    7·1 answer
  • Discuss how 3D modeling enhances animation.
    13·1 answer
  • Class C Airspace inner ring begins at the __________ and extends vertically (by definition) to MSL charted values that generally
    5·1 answer
  • Select the correct technical term for each definition by using the drop-down menus.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!