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
Whitepunk [10]
3 years ago
10

Iven an array temps of double s, containing temperature data, compute the average temperature. Store the average in a variable c

alled avgTemp. Besides temps and avgTemp, you may use only two other variables -- an int variable k and a double variable named total, which have been declared .
k = 0;
total = 0;
while (k < temps.length)
{
total = total + temps[k];
k++;
}

avgTemp = total / (temps.length);
Computers and Technology
1 answer:
ale4655 [162]3 years ago
6 0

Answer:

import java.util.Arrays;

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter length of the array:");

       int len = in.nextInt();

       double [] temps = new double[len];

       double avgTem;

       int k =0;

       double total = 0;

       for( k=0; k<temps.length; k++){

           System.out.println("Enter values for the array");

           temps[k]=in.nextDouble();

       }

       System.out.println("The Arrays contains the following values");

       System.out.println(Arrays.toString(temps));

       // Computing the average of the values

       for(k=0; k<temps.length; k++){

           total = total+temps[k];

       }

       avgTem = total/(temps.length);

       System.out.println("The average Temperature is: "+avgTem);

   }

}

Explanation:

  • Using Java programming language
  • Import the Scanner class to receive user input
  • Prompt User for the length of the Array, receive and store in a variable len;
  • Declare a new double array of size len double [] temps = new double[len];
  • Using a for loop, continually prompt user to enter values into the array
  • Display the values of the array using Java's Arrays.toString method
  • Use another for loop to add up all the elements in the arraay and store in the variable called total
  • Outside the second for loop calculate the average avgTem = total/(temps.length);
  • Display the average temp.
You might be interested in
What are the dominant InfoSec-related credentials used to document knowledge and/or experience?
timofeeve [1]

Answer:

One of the most widely cited information security certifications is the Certified Information Systems Security Professional (CISSP), offered by the International Information Systems Security Certification Consortium (ISC)2[1].

4 0
2 years ago
Which of the following allowed Temple Grandin to design more humane means of slaughtering cattle? she treated the cattle as inca
kotegsom [21]

Answer:  She used imagination and spatial-temporal reasoning

Explanation:

spatial-temporal reasoning is the ability to gestate the three-dimensional relationships of objects in space and to mentally manipulate them as a succession of transformations over a certain time. Also note that it is an area of artificial intelligence which comes from the fields of computer science, cognitive science, and cognitive psychology.

7 0
4 years ago
Read 2 more answers
How do computers use input and output to get and give the information that they need to solve problems?
SpyIntel [72]

Answer:

typing on a keyboard (input) makes letter appear on a screen (output)is removing that

5 0
3 years ago
1. A(n) ____ is a special type of inline image in which you define one or more areas as hotspots. *
3241004551 [841]

<span>1.       </span>Image map

Typically, web pages use different types of inline images. An image map defines one or more areas as hotspots and is a special type of inline image. For instance, every hotspot in an image map is able to link to a different page.


<span>2.       </span>Headings

Once the Web page structure is set, you can now enter content of the web page informational text paragraphs and headings. Headings separate text or add new topics on the page. Headings are indicated by the tags <h1> all through to <h6>


<span>3.       </span>Deprecated tags

<span>By default, W3C supports 3 document types for XHTML HTML, frameset, transitional, and strict. Strict is specified when you want to illegalize use of deprecated tags. Deprecated tags are tags that W3C has earmarked for eventual removal from their specifications because these tags have been replaced by much more newer and functional tags.
</span>
<span />

<span>4.       </span>Frameset document type

As mentioned above in question 3, W3C supports 3 document types for XHTML HTML, frameset, transitional, and strict. Frameset document type is used to support frames on a page and allows the use of deprecated tags.


<span>5.       </span>Definition list

Definition list is an example of a list that offsets info in a dictionary like style. They are not often used as compared to unordered and ordered lists and are important in creating a glossary like list of definitions and items.

6.       Virus.

A virus is a malicious software code that multiplies and replicates by copying itself to another application, document, boot sector and changes how a computer should operate. Typically, a computer virus cannot reproduce without programming a document or a file.


<span>7.       </span>Width Attribute

This attribute specifies the width of an image and the height specifies the height of an image. Both are measured in pixels and the value must always be in pixel. It specifies the width of a cell attribute and is used to set a predefined width of a cell.


<span>8.       </span>Alt attribute

Commonly used with the <img> tag, the alt attribute specifies an alternate image or text, if the image is not in a position to be displayed. The required alt attribute provides info of an image if a user for known or unknown reasons cannot view it.


<span>9.       </span>Color property

It defines the text for an HTML element. It is specified by the color name, a HEX value and an RGB value. The most common ways amongst these three is the HEX value. You can also use color name by replacing the HEX code with the name of the color.


<span>10.       </span>Source Code

Source code is that HTML code which is translated into a graphical web page by a browser. It is possible to view the source code for any page from within the web browser. Using this feature,  it can help one check his or her own code or for another developer.











6 0
3 years ago
Which of the following types of networks encrypts data for transmitting over
vova2212 [387]

Answer:a

Explanation:

3 0
3 years ago
Other questions:
  • Let K(x, y) denote the statement "x knows y" and D denote the domain of all people. Express the following English sentences as a
    9·1 answer
  • Most smartphones use operating systems developed by ________.
    10·1 answer
  • Why should you avoid the use of sarcasm , cliches, and idioms in business letters?
    6·2 answers
  • What coding language should i begin with if i'm looking to get into AI ?
    11·1 answer
  • 2 The software needed to send an email is:
    7·1 answer
  • List the instructions of how you would make a PBJ sandwich as a series of five (5) steps (tasks) in the first column Complete th
    14·1 answer
  • A host device needs to send a large video file across the network while providing data communication to other users. Which featu
    8·1 answer
  • The getting started screen in Microsoft publisher consists of which main parts?​
    7·1 answer
  • X= [12,67,89,34,56,90,67]
    6·1 answer
  • Anyone know how to do Calculator program in python ?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!