Create the following in swift:
Create a function that accepts a float for the wind speed and
returns a string message based on its result. Use a Switch
statement and ranges to handle all the cases, if something falls
outside the list display the message “there is no such
category”
Wind Speed (in MPH)
Result 74 to 95 - Category One
96 to 110 - Category Two
111 to 130 - Category Three
131 to 155 - Category Four
155 to the max possible float value - Category Five
Below is the solution:
swift code:
import Foundation
func windSpeed(windSpeed:Float)->String{ //create a windSpeed
and pass the
//declare the variable
var speed:Int = 0
var category:String = ""
//check for the wind speed category
if windSpeed >= 74 && windSpeed <=
95{
speed = 1
}
else if windSpeed >= 96 && windSpeed
<= 110{
speed = 2
}
else if windSpeed >= 111 && windSpeed
<= 130{
speed = 3
}
else if windSpeed >= 131 && windSpeed
<= 155{
speed = 4
}
else if windSpeed > 155 {
speed = 5
}
//pass the variable to set the wind
category
switch (speed){
case 1:
category = "Category
ONe"
case 2:
category = "Category
Two"
case 3:
category = "Category
Three"
case 4:
category = "Category
Four"
case 5:
category = "Category
Five"
default:
category = "There is no
such category"
}
return ("\(category)") //return the wind
category
}
var wind:String = windSpeed(windSpeed: 96) //call a function with float value and that function will return the string value and store in wind string variable
print(wind) //print the wind value
sample output:
Category Two
Create the following in swift: Create a function that accepts a float for the wind speed...
C# programming
Create an application that prompts the user for a storm windspeed in mph, then determines the correct typhoon category. The program must run all test cases of storm windspeed in one execution. Use a sentinel value to terminate the program. Do not assume a specific number of inputs. Determine the maximum storm windspeed value input. Note that the maximum must be evaluated within your program. You MAY NOT use C built in function. Output screenshot must include the...
PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....
I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...
I have this case study to solve. i want to ask which
type of case study in this like problem, evaluation or decision? if
its decision then what are the criterias and all?
Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...
How can we assess whether a project is a success or a
failure?
This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...