Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is an assignment that I\'m having a lot of trouble with. Please help if you

ID: 3621438 • Letter: T

Question

This is an assignment that I'm having a lot of trouble with. Please help if you can.

For this assignment, write a program that, rather than using multiple arrays to hold the city temperature information, it uses a single array of structures.

The structure that will be used in this programs will represent one city. It has fields for the city name, low temperature for the city, and high temperature for the city.

For the assignment, you will only need to declare one array that can hold a maximum of 30 elements:

NOTE: all of the functions mentioned in this logic are described below.

Fill the array by calling the buildArrays() function.

Display the title "Unsorted Cities Report"

Display the unsorted array by calling the printArrays() function.

Sort the array by calling the sortArrays() function.

Display the title "Sorted Cities Report"

Display the sorted array by calling the printArrays() function.

Calculate the average and standard deviation of the low and high temperatures by calling the calcStats function

Display the average and standard deviation of the low and high temperatures

The input for this program will be read from a disk file named binary_cities.txt. The file consists of a set of cityInfo records. Each record represents one city that has been written in BINARY.

This function will read the file of data and fill the array. It takes as its argument the array of cityInfo structures. It returns the number of valid cities that were placed in the arrays.

Suggested logic:

buildArrays notes:

The information in the file has been written in BINARY rather than regular text like the previous assignment. This means that the statement to open the file must be altered to make sure that the data is read properly. To open a file in BINARY mode and make sure that it opened correctly:

Since the data contains binary data rather than text, the information has to read in a slightly different manner. Rather than reading each field individually like in Program 7, each cities information will be read as a "chunk" of data by using the read function:

As in the previous assignment, to test if there are records in the file, simply use the name of the input file stream as a boolean variable.

As long as there are records in the file, the name of the input file stream name will resolve to true. Once all of the records have been read from the file, the input file stream name will resolve to false.

After all of the data has been read from the file, the file must be closed.

This function will display the information for the cities. For each city, display the city name, low temperature, and the high temperature.

This function takes as its arguments the array of cityInfo structures and the number of cities in the array.

Use the following as a basic format for the output:

This function will sort the arrays in ASCENDING order based on the city name. Use the selection sort algorithm presented in lecture.

This function takes as its arguments the array of cityInfo structures and the number of cities in the arrays.

Don't forget that since the city name is stored as a real C++ string (null-terminated character array) rather than using the string data type, the comparison of city names MUST be changed from program 7. Use the strcmp function instead of the < operator.

This function will calculate the average and standard deviation of the low and high temperatures.

This function takes as its arguments the array of cityInfo structures, the number of cities in the arrays, a reference to a double that will be used to pass-back the average of the low temperatures, a reference to a double that will be used to pass back the average of the high temperatures, a reference to a double to pass back the standard deviation of the low temperatures, and a reference to a double to pass back the standard deviation of the high temperatures.

See the Calculation Note at the end for the standard deviation formula.

Write the following functions and alter the printArrays() function to include calling statements for the functions.

This function will find the lowest temperature in the cities array and display the city that had the lowest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

This function will find the highest temperature in the cities array and display the city that had the highest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

Add #include <fstream> at the top of your program.

The array should be able to hold 30 elements. Use a symbolic constant to represent the maximum size of an array.

The array has the capability to hold 30 elements, however, that does not mean that they will all be used. This is the reason that the number of elements in the array is being passed to the sort and print functions. This value is the return value from buildArrays.

Copy the input file to your hard disk and write your program so that it reads the data from the current directory (ie. don't specify a file path).

Hand in a copy of your source code using Blackboard.

Here is the output for this assignment using the binary_cities.txt file from above. It includes the extra credit output.

The standard deviation is calculated by implementing the following formula:

where

For example, if an array contains the values:

then

For this assignment, re-write program 7 so that rather than using multiple arrays to hold the city temperature information, it uses a single array of structures.

The structure that will be used in this programs will represent one city. It has fields for the city name, low temperature for the city, and high temperature for the city.

For the assignment, you will only need to declare one array that can hold a maximum of 30 elements:

NOTE: all of the functions mentioned in this logic are described below.

Fill the array by calling the buildArrays() function.

Display the title "Unsorted Cities Report"

Display the unsorted array by calling the printArrays() function.

Sort the array by calling the sortArrays() function.

Display the title "Sorted Cities Report"

Display the sorted array by calling the printArrays() function.

Calculate the average and standard deviation of the low and high temperatures by calling the calcStats function

Display the average and standard deviation of the low and high temperatures

The input for this program will be read from a disk file named binary_cities.txt. The file consists of a set of cityInfo records. Each record represents one city that has been written in BINARY.

This function will read the file of data and fill the array. It takes as its argument the array of cityInfo structures. It returns the number of valid cities that were placed in the arrays.

Suggested logic:

buildArrays notes:

The information in the file has been written in BINARY rather than regular text like the previous assignment. This means that the statement to open the file must be altered to make sure that the data is read properly. To open a file in BINARY mode and make sure that it opened correctly:

Since the data contains binary data rather than text, the information has to read in a slightly different manner. Rather than reading each field individually like in Program 7, each cities information will be read as a "chunk" of data by using the read function:

As in the previous assignment, to test if there are records in the file, simply use the name of the input file stream as a boolean variable.

As long as there are records in the file, the name of the input file stream name will resolve to true. Once all of the records have been read from the file, the input file stream name will resolve to false.

After all of the data has been read from the file, the file must be closed.

This function will display the information for the cities. For each city, display the city name, low temperature, and the high temperature.

This function takes as its arguments the array of cityInfo structures and the number of cities in the array.

Use the following as a basic format for the output:

This function will sort the arrays in ASCENDING order based on the city name. Use the selection sort algorithm presented in lecture.

This function takes as its arguments the array of cityInfo structures and the number of cities in the arrays.

Don't forget that since the city name is stored as a real C++ string (null-terminated character array) rather than using the string data type, the comparison of city names MUST be changed from program 7. Use the strcmp function instead of the < operator.

This function will calculate the average and standard deviation of the low and high temperatures.

This function takes as its arguments the array of cityInfo structures, the number of cities in the arrays, a reference to a double that will be used to pass-back the average of the low temperatures, a reference to a double that will be used to pass back the average of the high temperatures, a reference to a double to pass back the standard deviation of the low temperatures, and a reference to a double to pass back the standard deviation of the high temperatures.

See the Calculation Note at the end for the standard deviation formula.

Write the following functions and alter the printArrays() function to include calling statements for the functions.

This function will find the lowest temperature in the cities array and display the city that had the lowest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

This function will find the highest temperature in the cities array and display the city that had the highest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

Add #include <fstream> at the top of your program.

The array should be able to hold 30 elements. Use a symbolic constant to represent the maximum size of an array.

The array has the capability to hold 30 elements, however, that does not mean that they will all be used. This is the reason that the number of elements in the array is being passed to the sort and print functions. This value is the return value from buildArrays.

Copy the input file to your hard disk and write your program so that it reads the data from the current directory (ie. don't specify a file path).

Hand in a copy of your source code using Blackboard.

Here is the output for this assignment using the binary_cities.txt file from above. It includes the extra credit output.

For this assignment, re-write program 7 so that rather than using multiple arrays to hold the city temperature information, it uses a single array of structures.

The structure that will be used in this programs will represent one city. It has fields for the city name, low temperature for the city, and high temperature for the city.

For the assignment, you will only need to declare one array that can hold a maximum of 30 elements:

NOTE: all of the functions mentioned in this logic are described below.

Fill the array by calling the buildArrays() function.

Display the title "Unsorted Cities Report"

Display the unsorted array by calling the printArrays() function.

Sort the array by calling the sortArrays() function.

Display the title "Sorted Cities Report"

Display the sorted array by calling the printArrays() function.

Calculate the average and standard deviation of the low and high temperatures by calling the calcStats function

Display the average and standard deviation of the low and high temperatures

The input for this program will be read from a disk file named binary_cities.txt. The file consists of a set of cityInfo records. Each record represents one city that has been written in BINARY.

This function will read the file of data and fill the array. It takes as its argument the array of cityInfo structures. It returns the number of valid cities that were placed in the arrays.

Suggested logic:

buildArrays notes:

The information in the file has been written in BINARY rather than regular text like the previous assignment. This means that the statement to open the file must be altered to make sure that the data is read properly. To open a file in BINARY mode and make sure that it opened correctly:

Since the data contains binary data rather than text, the information has to read in a slightly different manner. Rather than reading each field individually like in Program 7, each cities information will be read as a "chunk" of data by using the read function:

As in the previous assignment, to test if there are records in the file, simply use the name of the input file stream as a boolean variable.

As long as there are records in the file, the name of the input file stream name will resolve to true. Once all of the records have been read from the file, the input file stream name will resolve to false.

After all of the data has been read from the file, the file must be closed.

This function will display the information for the cities. For each city, display the city name, low temperature, and the high temperature.

This function takes as its arguments the array of cityInfo structures and the number of cities in the array.

Use the following as a basic format for the output:

This function will sort the arrays in ASCENDING order based on the city name. Use the selection sort algorithm presented in lecture.

This function takes as its arguments the array of cityInfo structures and the number of cities in the arrays.

Don't forget that since the city name is stored as a real C++ string (null-terminated character array) rather than using the string data type, the comparison of city names MUST be changed from program 7. Use the strcmp function instead of the < operator.

This function will calculate the average and standard deviation of the low and high temperatures.

This function takes as its arguments the array of cityInfo structures, the number of cities in the arrays, a reference to a double that will be used to pass-back the average of the low temperatures, a reference to a double that will be used to pass back the average of the high temperatures, a reference to a double to pass back the standard deviation of the low temperatures, and a reference to a double to pass back the standard deviation of the high temperatures.

See the Calculation Note at the end for the standard deviation formula.

Write the following functions and alter the printArrays() function to include calling statements for the functions.

This function will find the lowest temperature in the cities array and display the city that had the lowest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

This function will find the highest temperature in the cities array and display the city that had the highest temperature along with the temperature.

This function takes as its arguments the array of cityInfo structures, and the number of cities in the arrays.

Add #include <fstream> at the top of your program.

The array should be able to hold 30 elements. Use a symbolic constant to represent the maximum size of an array.

The array has the capability to hold 30 elements, however, that does not mean that they will all be used. This is the reason that the number of elements in the array is being passed to the sort and print functions. This value is the return value from buildArrays.

Copy the input file to your hard disk and write your program so that it reads the data from the current directory (ie. don't specify a file path).

Hand in a copy of your source code using Blackboard.

Here is the output for this assignment using the binary_cities.txt file from above. It includes the extra credit output.

The standard deviation is calculated by implementing the following formula:

where

For example, if an array contains the values:

then

The standard deviation is calculated by implementing the following formula:

where

For example, if an array contains the values:

then

Explanation / Answer

Dear, Tried maximum and able frame these function this will help you void printArrays( cityInfo cities[], int numCities ) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote