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

Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp

= {90, 92, 94, 95}, print:90, 92, 94, 95Note that the last element is not followed by a comma, space, or newline.import java.util.Scanner;public class PrintWithComma {public static void main (String [] args) {final int NUM_VALS = 4;int[] hourlyTemp = new int[NUM_VALS];int i = 0;hourlyTemp[0] = 90;hourlyTemp[1] = 92;hourlyTemp[2] = 94;hourlyTemp[3] = 95;/* Your solution goes here */System.out.println("");return;}}
Computers and Technology
1 answer:
slavikrds [6]3 years ago
3 0

Answer:

Here are the for loop for the given question.

 for (i = 0; i < NUM_VALS; i++)  // for loop

       {

         /* check if the value of i is equal to NUM_VALS or not.If it is

         equal then just print the value without comma.*/

       if(i==(NUM_VALS-1))  // if block

       System.out.print(hourlyTemp[i]);

  /* if i is not equal then just print the value with comma.*/

       else   // else block

       System.out.print(hourlyTemp[i] + ", ");

       }

Explanation:

In this we iterating the for loop  and check the condition

check if the value of i is equal to NUM_VALS or not.If it is  equal then just print the value without comma

If i is not equal then just print the value with comma .

Output:

90,92,94,95

You might be interested in
I need help with this!!! Are headphones, radios, dishwashers, and remote controls considered Computers? Do any of them store dat
Bogdan [553]

Answer:

Yes, these things can be considered a computer. And they can also store and process data.

Explanation:

Headphones, radios, dishwashers, and remote controls are all computers because they all have some sort of logic board inside the device to control what it does. Example, a dishwasher has internal components that it uses to keep track of how long the wash/rinse cycle have lasted and how long they are supposed to last.

I hope that helps!

7 0
3 years ago
There are two main types of hard drive available to a computer. State what they are and describe their use.
Gala2k [10]

Answer:

Hard disk drives (HDD), which use one or more rotating discs and rely on magnetic storage, and solid-state drives (SSD), which have no moving mechanical parts, but use flash memory like the kind found in USB flash drives.

Explanation:

6 0
2 years ago
• Suppose an application generates chunks of 40 bytes of data every 20 msec, and each chunk gets encapsulated in a TCP segment a
kobusy [5.1K]

Answer:

10

Explanation:

i don't know please just thank me

8 0
3 years ago
General description of the problem
Elden [556K]

Explanation:

problem is the misunderstanding misbehaviour etc which harm us and others

4 0
3 years ago
if you play creative destruction and if u have a mic and if u play it 24/7 and would like to form a team tell me your name or yo
kipiarov [429]

i dont know that game but ill see if i like it and if i do ill send u my ID number ok


8 0
3 years ago
Other questions:
  • Ken is a table busser at a restaurant. Ken's boss has requested that instead of waiting to be told what tables need to be cleane
    10·2 answers
  • What tool enables you to easily delete, add, or resize filesystems without regard to their physical locations on a hard disk?
    13·1 answer
  • Consider the concept of cultural lag. Identify two American values that are “lagging.” What are three norms that are lagging? Ho
    11·1 answer
  • A user can easily move to the end of a document by pressing the _____ key combination.
    10·2 answers
  • What is the most powerful gpu or known as the graphics card in the world?
    8·2 answers
  • Write a program that asks the user to enter the amount s/he has budgeted for a month. The amount should be between 1000 and 2000
    11·1 answer
  • Which of the following is NOT one of the modules of a typical Decision Support System (DSS)? Select one: a. Customer information
    14·2 answers
  • What was ARPANET?
    14·1 answer
  • Hey does anyone know the name of that movie where like this teenage girl is chilling at her house then there is an outbreak of s
    6·1 answer
  • What is the process called when programmers look for and fix errors in code? Analysis Debug Document Error check
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!