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
Kruka [31]
3 years ago
13

Consider the following class declaration: public class Square { private double sideLength; public double getArea() { return side

Length * sideLength; } public double getSideLength() { return sideLength; } } Assuming that a no-arg constructor already exists, write an overloaded constructor for this class. It should accept an argument that is copied into the sideLength field. The parameter’s name is s.
Computers and Technology
1 answer:
kipiarov [429]3 years ago
4 0

Answer:

Here is the constructor:

public Square(double s) {  //constructor name is same as class name

sideLength = s;  } //s copied into sideLength field

Explanation:

The above constructor is a parameterized constructor which takes a double type variable s as argument. The name of constructor is same as the name of class.This constructor requires one parameters. This means that all declarations of Square objects must pass one argument to the Square() constructor as constructor Square() is called based on the number and types of the arguments passed and the argument passed should be one and of type double.

Here is where the constructor fits:

public class Square {

private double sideLength;

public Square(double s) {  

sideLength = s;  }

public double getArea() {

return sideLength * sideLength;}

public double getSideLength() {

return sideLength; } }

You might be interested in
Which would be the most appropriate way to estimate -6.1(0.22)? Check all that apply.
Sergeu [11.5K]

Answer:

A.Use rounding to get -6(0.2), and then multiply. and D. use front end estimation to get -6(0.2), and multiply. and B.

Explanation:

just took the test

7 0
3 years ago
Read 2 more answers
Assume the variable date has been set to a string value of the form mm/dd/yyyy, for example 09/08/2010. (Actual numbers would ap
bonufazy [111]

Answer:

String date = "21/05/2020";

String dayStr = date.substring(0,2);

int day = Integer.parseInt(dayStr);

System.out.println(day);

Explanation:

Create a variable called <em>date</em> which holds the current date

Create a variable called <em>dayStr</em>. Initialize it to the day part of the <em>date</em> using the substring method

Create a variable called <em>day</em>. Parse the <em>dayStr</em> and assign it to the <em>day</em>

Print the <em>day</em>

6 0
3 years ago
Apples and bananas apples and bananas
melamori03 [73]

Answer:

bananas and apples bananas and apples?

Explanation:

8 0
3 years ago
Read 2 more answers
You defined a book data type.
tensa zangetsu [6.8K]

Answer:

myBook = book()

Explanation:

Correct answer edge 2020

4 0
3 years ago
Which printing process uses a toner that sticks to the charged drum and thermally fuses onto a page?
PSYCHO15rus [73]
<h2>Hello!</h2>

The answer is: B. electrostatic printing.

<h2>Why?</h2>

Electrostatic printing (laser printing) is the process where a laser beam passes   repeatedly (back and forth) over a negatively charged cylinder (drum) drawing a differentially charged image, then,  the drum is coated in electrically charged powder (toner), finally,  the paper is heated in order to fuse the toner to the paper.

Have a nice day!

7 0
3 years ago
Other questions:
  • This is the main work area of your computer.
    7·1 answer
  • Which of the following groups would an animal with an exoskeleton, segmented body, and jointed appendages belong to???
    14·2 answers
  • The Company management has asked that you compare the OSSTMM and the PTES to determine which methodology to select for internal
    13·1 answer
  • Which command is used to combine two or more cells together into one cell?
    14·2 answers
  • Identify which of these types of sampling is​ used: random,​ systematic, convenience,​ stratified, or cluster. To determine her
    13·1 answer
  • Which of the following is generally true about 401(k) and 403(b) retirement plans
    5·1 answer
  • What function returns a line and moves the file pointer to the next line?
    9·1 answer
  • A software development company wants to reorganize its office so that managers and the Computer Programmers they supervise can b
    13·2 answers
  • Mary is writing an article about the animal kingdom. She wants to place an image below the text. Which menu should Mary choose f
    14·1 answer
  • What is the meaning of photography​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!