
- State City Temperature Struct Create An Array Of Structs Called Place Temp With 3 Fields State A String Scalar With 1 (29.34 KiB) Viewed 44 times

- State City Temperature Struct Create An Array Of Structs Called Place Temp With 3 Fields State A String Scalar With 2 (30.02 KiB) Viewed 44 times

- State City Temperature Struct Create An Array Of Structs Called Place Temp With 3 Fields State A String Scalar With 3 (21.13 KiB) Viewed 44 times
State, city, temperature struct Create an array of structs called Place Temp with 3 fields: state, a string scalar with the name of the state, city, a string scalar with the name of the city, and temperature, a numeric variable with the annual high temperature in Celsius. The first item in Place Temp is associated with "California", then "Texas", and finally "Wisconsin". In "California", the city is "Modesto" and the annual high temperature is 24 degrees Celsius. In "Texas", the city is "Dallas" and the annual high temperature is 25 degrees Celsius In "Wisconsin", the city is "Madison" and the annual high temperature is 13 degrees Celsius. The function CityDataStructure() calls the function TempCalc(), which converts the temperatures in Place Temp from Celsius to Farenheit. The formula to convert Celsius to Farenheit is: T(°F) = T("C) x 9/5 +32 Ex: Running the script produces ModestoFarenheit = 75.2000 DallasFarenheit = 77 MadisonFarenheit = 55.4000 Script 1 PlaceTempStructure.state=0; 2 PlaceTempStructure.city=0; Place TempStructure. temperature=0; PlaceTemo(1) states California: Save C Reset MATLAB Documentation
Script 1 PlaceTempStructure.state=0; 2 PlaceTempStructure.city=0; Place TempStructure. temperature=0; 4 PlaceTemp (1).state='California'; s PlaceTemp (1).city="Modesto'; 6 Place Temp (1). temperature=24; 7 PlaceTemp (2).state="Texas'; 8 PlaceTemp(2).city='Dallas': 9 PlaceTemp (2). temperature-25; 10 PlaceTemp (3).state='Wisconsin'; 11 PlaceTemp (3).city='Madison'; 12 PlaceTemp (3). temperature=13; 13 PlaceTemp (1)-TempCalc (Place Temp (1)); 14 Place Temp (2)=TempCalc(Place Temp(2)); 15 PlaceTemp(3)=TempCalc(Place Temp (3)); 16 17 ModestoFarenheit PlaceTemp(1). temperature in Dallas Farenheit = PlaceTemp (2). temperature 19 MadisonFarenheit PlaceTemp (3). temperature 20 21 function PlaceTemp = TempCalc (PlaceTemp) 22 PlaceTemp. temperature PlaceTemp. temperature 9/5+32 24 25 end 26 Save C Reset MATLAB Documentation Run Script
Previous Assessment: 3 of 4 Tests Passed (75%) Check the structure is created correctly. Variable Place Temp has an incorrect value. Check the temperature for Modesto is converted correctly. Check the temperature for Dallas is converted correctly. Check the temperature for Madison is converted correctly. Submit 0% (25%) 25% (25%) 25% (25%) 25% (25%) Total: 75%