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

What is wrong with each of the following code segments? int[] values; for (int i = 0; i < values.length; i++) { values[i] = i

* i; }
Computers and Technology
1 answer:
tino4ka555 [31]3 years ago
7 0

Answer:

values have been declared but not initialized nor allocated memory. So you are not allowed to use "values.length"

You might be interested in
Which tab should you click if you want to access the Show All Comments option in a worksheet?
Lostsunrise [7]

Answer: Review

Because you want to review the comments

3 0
3 years ago
Read 2 more answers
Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volu
marysya [2.9K]
<h2>Question:</h2>

Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations:

Volume = base area x height x 1/3

Base area = base length x base width.

(Watch out for integer division)

import java.util.Scanner;

public class CalcPyramidVolume {

   /* Your solution goes here */

   public static void main (String [] args) {

     System.out.println("Volume for 1.0, 1.0, 1.0 is: " + pyramidVolume(1.0, 1.0,   1.0));

     return;

    }

}

<h2>Answer:</h2><h2></h2>

import java.util.Scanner;

public class CalcPyramidVolume {

   /* Your solution goes here */

   public static void main (String [] args) {

       System.out.println("Volume for 1.0, 1.0, 1.0 is: " + pyramidVolume(1.0, 1.0, 1.0));

       return;

   }

   

   //Begin method definition

   public static double pyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

       

       //First, calculate the base area of the pyramid

       //store the result in a double variable

       double baseArea = baseLength * baseWidth;

       

       //Then, calculate the volume of the pyramid

       //using the base area and the base width

       double volume = 1 / 3.0 * baseArea * pyramidHeight;

       

       //return the volume

      return volume;

   }

}

<h2>Output:</h2>

Volume for 1.0, 1.0, 1.0 is: 0.3333333333333333

<h2>Explanation:</h2>

The code above contains comments explaining the important lines of the code. The output of the code has also been provided above.

The parts of the code that are worth noting are:

(i) The return type of the method pyramidVolume should be a <em>double</em> since calculations are done using <em>double</em> values. i.e the method header should be written as

<em>public static double pyramidVolume(){</em>

<em>}</em>

<em />

(ii) The method requires three(3) parameters of type double: baseLength, baseWidth and pyramidHeight. These should be included in the method. Therefore, the complete header definition should be:

<em>public static double pyramidVolume(double baseLength, double baseWidth, double pyramidHeight){</em>

<em />

<em>}</em>

(iii) The formula for calculating the volume of the pyramid should be:

volume = 1 / 3.0 * baseArea * baseWidth;

Rather than;

volume = 1 / 3 * baseArea * baseWidth;

This is because integer division yields integer result. If 1 / 3 is evaluated, the result will be 0 since the decimal part will be truncated thereby making the result of the volume = 1 / 3 * baseArea * baseWidth will be 0.

Therefore, the work around for that should be to write 1 / 3.0 or 1.0 / 3.0 or 1.0 / 3.

(iv) After the calculation, the result of volume should be returned by the method. This will enable a proper call by the main method for execution.

7 0
3 years ago
Which best describes the condition under which the Unicode output is the same as plain text?
Nostrana [21]

Answer:

When the text contain the ASCII code (Which contains the character) is the correct answer of the above question.

Explanation:

ASCII is used for the Unicode for the computer system. The full form of this is the American standard code of information interchange.  It is a code that is used by the computer system for their personal use. It is because no one can hack the information from the system. If anyone can do so then they can get that text which has no mean.

The above question asked about the condition in which Unicode output is the same from plain text. So the answer is ASCII code because the ASCII code and the Unicode are the same. The only difference between them is the representation of bits.

3 0
3 years ago
How to get amount after a percentage increase in excel​
Tresset [83]

Answer:

First: work out the difference (increase) between the two numbers you are comparing.

Increase = New Number - Original Number.

Then: divide the increase by the original number and multiply the answer by 100.

% increase = Increase ÷ Original Number × 100.

Explanation:

3 0
2 years ago
Read 2 more answers
Your job is to write a basic blurring algorithm for a video driver. The algorithm will do the following: it will go through all
nekit [7.7K]
I’m pretty sure answer is B let me know if I’m wrong
4 0
4 years ago
Other questions:
  • Select the correct answer.
    8·1 answer
  • Gross Domestic Product is equivalent to which of the following?
    13·1 answer
  • Why does the PC send out a broadcast ARP prior
    14·1 answer
  • Describe the difference between public and private IPv4 addresses. If a network is using private IP addresses, how can the compu
    13·1 answer
  • Which sentence best describes a lifestream?
    8·2 answers
  • Median of a sample If the distribution is given, as above, the median can be determined easily. In this problem we will learn ho
    15·1 answer
  • To distribute one or more presentations for use on another computer, which of the following features should you use?
    13·1 answer
  • Any song recommendations, pls dont say 6ix9ine or lil pump
    5·2 answers
  • There are a wide variety of nonsampling errors that can occur during data collection including the first type, ________.
    7·1 answer
  • Which of the mis systems uses both informal and formal information-gathering procedures?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!