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
vivado [14]
3 years ago
12

Consider the following implementation of a class Square:

Computers and Technology
1 answer:
DaniilM [7]3 years ago
4 0

Answer:

The answer to this question can be given as:

Code:

class Square   //define class Square

{

Private int sideLength;  //define variable  

Square(int length)   //define parameterized constructor.        

{

sideLength = length;        //hold value of the parameter

}

int getArea()                  //define function getArea.

{

Private int area;            //define variable.

area = sideLength * sideLength;          //calculate area.

return area;            //return value.

}

}

Explanation:

In this question it is not a good idea to introduce an instance variable for the area because It may be a different method that defines the same variable with the same name but different variables because they are related to different functions, so it is better to make this variable local in this case.

You might be interested in
John wants to add a border to an image he has inserted on a slide. Which of the following groups on the Picture Tools Format tab
weeeeeb [17]

great question I don't know the answer

4 0
3 years ago
A commonly-used estimate for the number of bytes needed to store one
Basile [38]

Answer:

0.127 miles ; 5.458 *10^8 miles

Explanation:

Number of bytes needed to store a page = 2000

Number of pages (Harry Potter's book) = 800

Total memory required to store entire book = (2000 * 800) = 1600000 = 16 * 10^5 bytes

Hence,

1 byte of memory will store : (height of each book / memory size of each book)

= 3 ÷ 16 * 10^5

= 1.875 * 10^-6

For 32 bit memory space :

(1.875 * 10^-6 * 2^32) = 8053.06368 inches

1 inch = 1.578 * 10^-5 mile

8053.06368 inches = 8053.06368 * (1.578 * 10^-5) = 0.1270773448704 miles

= 0.127 miles

For 64 bit memory size :

(1.875 * 10^-6 * (2^64)) = 3.45876 * 10^13 inches

(3.45876 * 10^13) * (1.578 * 10^-5)

= 5.458 *10^8 miles

3 0
3 years ago
Overview: In this problem, you will emulate the push_back function of the C vector class. We will call this function append . Th
lbvjy [14]

Answer:

idontttttttttttttttttt now please help me

6 0
3 years ago
You have recently been hired as the staff attorney at a growing independent film studio in Van Nuys, California. Among your duti
expeople1 [14]

Answer: dude it’s all mussed in where the question

Explanation:

4 0
3 years ago
The windows desktop contains a start button in its lower-right corner, which can be used to start the computer.
WITCHER [35]
If you are referring to the actual desktop interface inside windows, it goes down to what version you would have. But to my knowledge, there is no start button in the lower right corner. 
6 0
4 years ago
Other questions:
  • Create a Python program as described below and save it in a file named bool. You should use IDLE or similar environment to creat
    15·1 answer
  • The answer to this question
    10·2 answers
  • Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a li
    15·1 answer
  • #include <iostream>
    9·1 answer
  • A broker statement is an example of an ___ record
    12·2 answers
  • Propose a data structure that supports the stack push and pop operations and a third operation findMin, which returns the smalle
    12·1 answer
  • On his website, Mario has a video that visitors must click to play. He wants the video to play automatically when the page loads
    9·1 answer
  • You enter information by keying it into the??​
    8·2 answers
  • Hello everyone! can anybody help me? i need help with computing.
    10·1 answer
  • Why is quantum computing potentially a better fit for weather forecasting than classical computers?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!