Sale!

COSC6000 Homework 09

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

Develop a class called BaseballPark that stores Baseball Parks data Your class will have at least five member variables. (must be private) type std::string to represent the franchise. type std::string to represent the name of stadium. type std::string to represent the name of city. type int to represent the capacity. type USLength to represent the center field dimension. You have developed USLength class in HW7. The complete class will include all the following member functions: a constructor to set a franchise, stadium, city, capacity and center field dimension as BaseballPark park(franchise, stadium, city, capacity, centerField); a default constructor (takes no input) that sets name=”NA”, and default number (maybe 0). Mutators for each member variable. Accessors for each member variable. Add “const” modifier for member function that does not modify member variables. Develop C++ code to process following tasks: Reads “MajorLeagueBallparks.csv” and store those in an array. Download the file from here.  How to read CSV (Comma­Separated Values) file in C++? See below or see here (http://www.cplusplus.com/forum/general/13087/) . Use your BaseballPark class to recored data. Use std::vector container class to store all data in an array. Your vector type must be like: std::vector baseballParks; Sort the array data with the center field geometry in descending order. Stadium of longest center field comes first and the shortest goes to end. You must use “sort” function from “algorithm” library. Export the sorted data to “rankStadium.csv” with CSV format.  File must have franchise, stadium, city, capacity and center field dimension data. You can start with code below: #include #include #include #include #include 4/23/2018 Homework 09 https://tulane.instructure.com/courses/2165899/assignments/13468234 2/3 #include “USLength.h” class BaseballPark{ public: BaseballPark(); BaseballPark(std::string franchise,std::string stadium,std::string city,int capacity,USLength cente rField); /// member/friend functions private: std::string franchise; std::string stadium; std::string city; int capacity; USLength centerField; // you may need your namespace }; /// /// your code here /// int main(int argc, const char * argv[]) { // YOUR code here std::ifstream infile; infile.open(“MajorLeagueBallparks.csv”);// Path to the CSV file if (infile.fail()){ std::cout << “file not found\n”; return -1; } std::string franchise; std::string stadium; std::string city; int capacity; int yards; int feet; std::string entry; std::string line; while (std::getline(infile,line)){ std::stringstream ststrm(line); std::getline(ststrm,franchise,’,’); std::getline(ststrm,stadium,’,’); std::getline(ststrm,city,’,’); std::getline(ststrm,entry,’,’); capacity = std::stoi(entry); std::getline(ststrm,entry,’,’); yards = std::stoi(entry); std::getline(ststrm,entry); feet = std::stoi(entry); USLength centerField(yards,feet,0);//you might need namespace BaseballPark bbpark(franchise,stadium,city,capacity,centerField); // YOUR code here 4/23/2018 Homework 09 https://tulane.instructure.com/courses/2165899/assignments/13468234 3/3 } // Sort the array data with the center field in descending order. // export to a CSV file return 0; }  Upload your USLength class files as well as your code if you make some changes onUSLength class.