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
Sav [38]
3 years ago
7

Questions 6 - 9 Refer to the following code: public class WhatsIt { private int[] values; private double average; public WhatsIt

() { values = new int[10]; findAvg(); } public WhatsIt (int[] n) { values = n; findAvg(); } public void findAvg () { double sum = 0; for (int i = 0; i < values.length; i++) { sum += values[i]; } average = 1.0 * sum / values.length; } public String toString() { return "Average: " + average + " Length: " + values.length; } } What does the line findAvg(); in the constructor do? Creates a reference to the average variable. Calls the method findAvg() so the variable average is updated correctly. Calls the constructor findAvg; so the object can be created in memory. This call should be removed. Checks to see if the average variable has been initialized
Computers and Technology
1 answer:
gavmur [86]3 years ago
4 0

Answer:

class WhatsIt

{

private static int [] values;

private double average;

public Double Average=average;

public WhatsIt () {values = new int [10]; findAvg(); }

public WhatsIt (int [] n) {values = n; findAvg(); }

public static void findAvg ()

{double sum = 0;

for (int i = 0; i < values.length; i++)

{sum += values[i]; }

average = 1.0 * sum / values.length;

System.out.println(Average);

System.out.println(average);

}

public static String ToString()

{

   System.out.println(average); System.out.println(values.length);

   return "Average: " + average + " Length: " + values.length;

}

public static void main(String[] args)  

{

    //WhatsIt();

    //ToString();

    findAvg();

}

}

The findAvg() calculates the average.

The reference to average is defined as below:

public double Average=average;

And when we call findAvg average is initialized, and Average is also initialized, which we can check through println statement.

Explanation:

Please check the answer section.

You might be interested in
The document responsible for describing the type of data stored in the database is called the:
vredina [299]

it's called the data dictionary

6 0
3 years ago
He smallest network is a ______________________, which is a network of personal devices, such as the network you use when you sy
scoray [572]
<span>The smallest network is a </span>personal area network,<span> which is a network of personal devices, such as the network you use when you sync your cell phone and your computer. </span>personal area network
8 0
2 years ago
The purpose of __________________ is to isolate the behavior of a given component of software. It is an excellent tool for softw
OLga [1]

Answer:

d.) black-box testing

Explanation:

Software testing can be regarded as procedures/process engage in the verification of a system, it helps in detection of failure in the software, then after knowing the defect , then it can be corrected. Black Box Testing can be regarded as a type of software testing method whereby internal structure as well as design of the item under test is not known by one testing it. In this testing internal structure of code/ program is unknown when testing the software, it is very useful in checking functionality of a particular application. Some of the black box testing techniques commonly used are; Equivalence Partitioning, Cause effect graphing as well as Boundary value analysis. It should be noted that the purpose of black-box testing is to isolate the behavior of a given component of software.

3 0
3 years ago
Hardware consists of the physical devices associated with a computer system, where software is the set of instructions the hardw
Vikki [24]

Answer: a)True

Explanation:

  • Hardware is the component of computing system that contains physical devices and parts through which commands are given by user by touching or pressing the physical device.E.g- keyboard, mouse etc.
  • Software is the program set or series of instructions that is run in the form of command to get executed in computing system.It carries out to instruction to perform tasks.E.g-application of computer
  • Other option is incorrect as the statement is true.
  • Thus, the correct option is option(a).
6 0
3 years ago
What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
Tomtit [17]

The answer is Tablets. It is a portable personal computer, generally with a mobile operating system and LCD touchscreen display processing circuitry, and a rechargeable battery in a single thin, flat package. It is bigger than smartphones.

7 0
3 years ago
Other questions:
  • How does Hadoop work? It breaks up Big Data into multiple parts so each part can be processed and analyzed at the same time on o
    5·1 answer
  • The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
    11·2 answers
  • Write a paper, 2-3 paragraphs that discuss how to defend ideas objectively through effective communication. Include the skills n
    6·1 answer
  • darren wants to substitute every occurence of the word bulky in his spreadsheet with the word strong. which of these options sho
    9·2 answers
  • A film camera with only one lens is known as a(n)?
    11·1 answer
  • Given the following sets, for each set operation provide the elements of the resulting set in set notation or using a well-known
    5·1 answer
  • What is the maximum current that should be allowed in a 5.0w 220 resistor?
    12·1 answer
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • Ranboo back story? (not homework i just wanna find some ppl who are interested in the same things) ft. the reddie meme
    9·2 answers
  • Qr code is more developed than barcode​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!