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
harina [27]
3 years ago
6

Create a class called Circle, which has (i) an attribute radius, (ii) a method that returns the current radius of a circle objec

t, (iii) a method that allows the user to reset the radius of a circle, (iv) a method that calculates the area of the circle, and (v) a constructor that takes a number as parameter input and assign the number as the initial value of radius.
Computers and Technology
1 answer:
nadya68 [22]3 years ago
8 0

Answer:

Explanation:

The following class is written in Java. I created the entire Circle class with each of the methods and constructor as requested. I also created a tester class to create a circle object and call some of the methods. The output can be seen in the attached picture below for the tester class.

class Circle {

   double radius;

   public Circle(double radius) {

       this.radius = radius;

   }

   public double getRadius() {

       return radius;

   }

   public void resetRadius() {

       radius = 0;

   }

   public double calculateArea() {

       double square = Math.pow((Math.PI * radius), 2);

       return square;

   }

}

You might be interested in
As you will solve more complex problems, you will find that searching for values in arrays becomes a crucial operation. In this
sergeinik [125]

Answer:

#include<iostream>

using namespace std;

int main() {

cout<<"Enter The Size Of Array: ";

int size;

bool isBestCase=false;

cin>>size;

if(size<=0){

cout<<"Error: You entered an incorrect value of the array size!"<<endl;

return(0);

}

int array[size], key;

cout<<"Enter the numbers in the array, separated by a space, and press enter:";

// Taking Input In Array

for(int j=0;j<size;j++){

cin>>array[j];

}

//Your Entered Array Is

for(int a=0;a<size;a++){

cout<<"array[ "<<a<<" ] = ";

cout<<array[a]<<endl;

}

cout<<"Enter a number to search for in the array:";

cin>>key;

for(i=0;i<size;i++){

 if(key==array[i]){

   if(i==0){

     isBestCase=true; // best case scenario when key found in 1st iteration

     break;

   }

 }

}

if(i != size){

 cout<<"Found value "<<key<<" at index "<<i<<", which took " <<++i<<" checks."<<endl;

}  else{

 cout<<"The value "<<key<<" was not found in array!"<<endl;

 cout<<"We ran into the worst-case scenario!"; // worst-case scenario when key not found

}

if(isBestCase){

cout<<"We ran into the best case scenario!";

}

return 0;

}

Explanation:

The C++ source dynamically generates an array by prompting the user for the size of the array and fills the array with inputs from the user. A search term is used to determine the best and worst-case scenario of the created array and the index and search time is displayed.

5 0
3 years ago
An auxiliary view is always projected from the view that shows the inclined surface as a(n) _____.
ValentinkaMS [17]
Auxiliary section i think
8 0
3 years ago
Gave me six external part of the computer system and identify which is the output and input devices
Mariana [72]
1. monitor output
2. keyboard input
3. mouse input
4. <span>microphone input</span>
5. printer output , or input if it has scanner
<span>6. speakers output</span>
5 0
3 years ago
FREEE POINTS
BigorU [14]

Answer:

Thank you that's so very kind of you. Hope your having a good day.

3 0
3 years ago
Read 2 more answers
L00000000000000000000000000000000000000000000000000000000l they b00ty tickled
Sidana [21]

Answer:

same bruh

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Is this picture the CPU, RAM, CD, or Operating System
    15·1 answer
  • ] why was drone-defense equipment deployed at airports in the United Kingdom?
    13·1 answer
  • Select the instances in which you should include a comma.
    14·1 answer
  • Which type of spreadsheet cell represents the left hand sides (lhs) formulas in an optimization analysis?
    5·1 answer
  • Membrane-bound organelles are not found in the cells of A) bacteria. B) fungi. C) plants. Eliminate D) protists.
    15·2 answers
  • The _____ handles the instructions for your computer to start up before the operating system is loaded.
    11·1 answer
  • Which of the following, (1) money deposited in a bank account, (2) student recording her answer to a question in an online test,
    14·1 answer
  • Write two methods: encrypt and decrypt. encrypt should #take as input a string, and return an encrypted version #of it according
    6·1 answer
  • Please help! i need to answer this soon!
    13·1 answer
  • g Write a recursive function all capital (L,start ,stop) that takes a string L and two integers. It returns a Boolean (True/Fals
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!