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]
2 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]2 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
Put these events in the order in which they occurred,
lakkis [162]

Answer:

  1. Local fisherman recover the body of Major Martin off the coast  of Spain .
  2. Spanish officials pass off the information in the briefcase to  German agents.
  3. Major Martin's name appears on a casualty list in a British  newspaper.
  4. Germany prepares for an imminent attack on the island of  Sardinia.

Explanation:

This above is the order in which Operation Mincemeat was executed in WW2 to deceive the Germans into believing that the Allies were going to invade the Balkans directly instead of Sicily which was their actual target.

The plan involved a fictitious Major Martin who had secret documents about the Allied invasion of the Balkans. After the body was released from a British submarine, it washed up in Spain where it was found by local fishermen.

Spanish officials then passed the information in the briefcase Major Martin had to German intelligence. To further reinforce the ruse, the British published Major Martin's name in a casualty list.

The Germans were thoroughly convinced and switched forces from Sicily for the defence of the Balkans and the island of Sicily.

5 0
3 years ago
What is a key function of a scrum master plato answer plz
sdas [7]
The scrum master is the team role responsible for ensuring the team lives agile values and principles and follows the processes and practices that the team agreed they would use.
6 0
3 years ago
A new user needs access to their files in iCloud without relying on the operating system (OS). How would the user access the App
m_a_m_a [10]

Answer:

Log in to iCloud.com on a browser

Explanation:

On your browser which should be a supported browser, you should log in to iCloud.com since iCloud is not supported on mac OS X earlier than mac OS X Lion 10.7.5

7 0
2 years ago
Which term describes the distinct number of colors a graphic contains? (1 point)?
laila [671]
Your answer would be "Hue".
4 0
3 years ago
If you want an app to reach the largest possible audience, which two platforms should you use?
Papessa [141]

Android Studio for Android, and Xcode for Apple devices.

6 0
2 years ago
Other questions:
  • Evidence that Social media hasn’t improved human communication.
    12·1 answer
  • • Write a program to find the maximum, minimum, and average score of players. The input to the program is a file containing play
    9·1 answer
  • Which of the following is not an advantage of using asynchronous data transmission
    15·1 answer
  • The device used to connect a network to the internet is called a
    7·1 answer
  • A type of wireless local area network technology​
    7·2 answers
  • Write an Enlistee class that keeps data attributes for the following pieces of information: • Enlistee name • Enlistee number Ne
    7·1 answer
  • Splunk knows where to break the event, where the time stamp is located and how to automatically create field value pairs using t
    7·1 answer
  • Which of the following are disadvantages of networks? Check all of the boxes that apply.
    14·1 answer
  • IN EXCEL, File, menu , edit, insert are all located in ?
    7·1 answer
  • assume there are K sorted lists, each of n/k elements. We want to merge them into a single sorted list of n elements. Give an op
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!