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]
2 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]2 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
Plz go sub 2 "Shyy096" he is a 11 y/o boy and makes music fortnite vids, it would rly help him if u subscribe cuz he only has 8.
Pachacha [2.7K]

Answer:

OKK

Explanation:

5 0
2 years ago
1| def saveUserProfile(firstName, lastName, age, height, country):
Feliz [49]

Answer:

Joyner

David

USA

1.8

30

Explanation:

def saveUserProfile(firstName, lastName, age, height, country):

This is the definition of function named saveUserProfile which accepts the following parameters:

  • firstName
  • lastName
  • age
  • height
  • country

filename = lastName + firstName + ".txt"

When the file is created it will be named as the lastName and firstName string combined with .txt as extension. For example if the lastName contains the name string Joyner and firstName contains the name David then the file created to be written is named as JoynerDavid.txt

outputFile = open(filename, "w")

This statement uses open() method in write mode and uses outputFile object to access the file. "w" represents write mode i.e. file is opened in write mode to write on it.

a) Joyner is written on line 1 of that file because of the following statement of above function:

print(lastName, file = outputFile)

This statement prints the string stored in lastName i.e. Joyner. Here outputFile opens the file in "w" write mode and writes the last name to the first line of the file.

b) David is written on line 2 of that file because of the following statement of above function:

print(firstName, file = outputFile)

This statement prints the string stored in firstName i.e. David. Here outputFile opens the file in "w" write mode and writes the first name to the second line of the file.

c) USA is written on line 3 of that file because of the following statement of above function:

print(country, file = outputFile)

This statement prints the data stored in country i.e. USA. Here outputFile opens the file in "w" write mode and writes the country name to the third line of the file.  

d) 1.8 is written on line 4 of that file because of the following statement of above function:

print(height, file = outputFile)

This statement prints the value stored in height i.e. 1.8. Here outputFile opens the file in "w" write mode and writes the height value to the fourth line of the file.  

e) 30 is written on line 5 of that file because of the following statement of above function:

print(age, file = outputFile)

This statement prints the value stored in age parameter of function saveUserProfile i.e. 30. Here outputFile opens the file in "w" write mode and writes the age value to the fifth line of the file.  

7 0
3 years ago
A technician is troubleshooting a Windows system in which an application works properly when the computer is booted in Safe Mode
sweet-ann [11.9K]

Answer:

yoooo nba BAD BAD

Explanation:

3 0
3 years ago
You can tell when an image is selected, because its sizing handles will be visible. True or False
Ivenika [448]

This is true because you can go and check yourself in Word and you can click on an image and the sizing handles will appear.

hope that helps :)

8 0
3 years ago
Read 2 more answers
Which answer would it be?
tigry1 [53]
<h2>My Answer:</h2>

FTP: The definition on Wikipedia is; "The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network."

So, if the question is asking for technology that provides a method for two computers hooked to the internet transfer files back and forth between each other, so if we can sum it up the answer which makes the most sense is <em>FTP</em>.

~TheExpertNerd

3 0
3 years ago
Other questions:
  • Which type of image uses lossy compression to reduce file size?
    14·1 answer
  • Computer keyboard failures can be attributed to electrical defects or mechanical defects. A repair facility currently has 25 fai
    14·1 answer
  • What is the FTC used car rule
    12·1 answer
  • Which cell formatting is most likely to use $?
    5·1 answer
  • Python
    6·1 answer
  • When you heat a pot on a stove, the handle gets warm. which type of heat transfer is possible
    10·2 answers
  • which of these tools stick to the edge of an image, thus making it easy to select the shape of an image
    6·1 answer
  • Which plan includes procedures and processes that ensure the smooth functioning of the business even after a disaster?
    14·2 answers
  • What are hard ware and software requirments in multimedia computer system
    5·1 answer
  • 1. A cell is identified by its ........
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!