Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you rewrite this Java code in the Swift programming language? k* 2 Reads temperatures from the user and shows which are above 3 and

Can you rewrite this Java code in the Swift programming language?

image text in transcribed

k* 2 Reads temperatures from the user and shows which are above 3 and which are below the average of all the temperatures 4. 5 import java.util.Scanner; 6 public class ArrayOfTemperatures2 8 public static void main (String [] args) Scanner keyboard new Scanner (System.in); System.out println ("How many temperatures do you have?"); int size keyboard.nextInt ; double [] temperaturenew double [size]; // Read temperatures and compute their average: System.out println ("Enter"+ temperature.length + 10 14 15 16 " temperatures: "); double sum0 for (int index = 0 ; index temperature. length ; index++) 18 temperature [index] keyboard.nextDouble (); sum sum + temperature [index] 20 double average sum / temperature.length; System.out println ("The average temperature is "+ 23 24 25 26 average) // Display each temperature and its relation to the average: System.out.println ("The temperatures are"); for (int index = 0 ; index temperature length ; index++) 28 29 it (temperature [index]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the risks of using the Interest Rate Swap?

Answered: 1 week ago