Question: 1) Create a class named Country with a default constructor, a public methods ReadFile, getMaxAreaState and a public data members- stateName, which is an array

1) Create a class named Country with a default constructor, a public methods ReadFile, getMaxAreaState and a public data members- stateName, which is an array with 50 string values area, which is an array of 50 integer values. Use -1.0 to initialize all the area values of the array and empty string for the stateName values initialization. 2) The public method ReadFile will read each line from the given filename and store each value into the arrays. Each line of the file contains a stateName and its area separated by a comma. This method does not return a value Please note, each line in the file contains a stateName and its area but not necessarily in order, you need to determine if the read value is a stateName or area. Note: state names will be in lower case only. Hint: stateName will consist of only alphabets and area only of digits. e.g. Data in File can be in following order: alaska, 1723337 colorado,269601 219882,utah 295234,arizona 3) The public method getMaxAreaState returns the name of the state with maximum area. You only need to write the class definition and any code that is required for that class. Place all code within the class definition. Our code will create and test your class. NOTE: We have provided a function that may make the parsing easier: int split(string s, char sep, string words [], int max_words)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
