美文网首页
C++代写 ECS40 Winter 2017代做C/C++编

C++代写 ECS40 Winter 2017代做C/C++编

作者: qvpzdl0 | 来源:发表于2019-03-10 14:45 被阅读0次

Introduction提交只需要提交所有的.c和.h 以及 makefile不需要提交Facilities.txt 和Runways.txtRequirementECS40 Winter 2017 2017-03-07Homework 4 due Sun 2017-03-19 at 20:00Use the handin directory hw4 to submit your workEmergency landing applicationDescriptionIn this assignment (HW4), you will implement a program called mayday that prints a list ofairports and runways that are closest to a given location. The program will list airports that haverunways longer than a given minimum length. It will also print the distance from the givenlocation to the airport. In a fictional scenario, a pilot who encounters an emergency situationwould use your program to get a list of the nearest landing options. The pilot would enter his/hercurrent location as latitude and longitude (in degrees decimal) as well as the minimum runwaylength needed to land (in ft).This assignment will test your C++ proficiency in opening and reading text files, using strings,using STL containers, using STL algorithms, and implementing function objects.Program specificationThe program will read data from two text files containing information about Federal AviationAdministration (FAA) facilities and runways. The files Facilities.txt andRunways.txt are provided and contain a list of 19700 facilities (such as airports, heliports,seaplane bases) and 23595 runways located mostly in the United States, but also in remotelocations. Each line in the Facilities.txt file contains the description of a facility (airport,heliport or seaplane base). The first part of the line contains the site number, a 10-character stringthat uniquely identifies the facility. The rest of the line contains other information, including thefacility type, name, code, and position (latitude and longitude in various formats). For example,San Francisco International Airport has site number 02187.A , type AIRPORT , code SFO,name SAN FRANCISCO INTL , latitude 135427.7000N and longitude 440551.5000W(expressed in seconds decimal). The positions of these fields in the line are:- Site number: characters 1-10- Type: characters 12-24- Code: characters 25-28- Name: characters 131-180- Latitude (sec decimal): characters 536-547- Longitude (sec decimal): characters 563-574Other fields are not relevant to this assignment.Each line in the Runways.txt file contains the description of a runway. The first part of theline contains the site number of the facility it belongs to (i.e. the 10-character string describedabove). The rest of the line contains other information about the runway, including its name andlength (in feet). For example, runway 10L/28R of San Francisco International airport has sitenumber 02187.A , name 10L/28R and a length of 11870 ft. The positions of these fields inthe line are:- Site number: characters 1-10- Name: characters 14-20- Length: characters 21-25Other fields are not relevant to this assignment.The mayday program will read the current position (latitude and longitude in degrees decimal)and minimum runway length from the command line arguments.The program should then open and read the text files, create appropriate Facility andRunway objects, and store them using STL vectors. The facilities should then be sorted in orderof proximity to the current location using the STL sort algorithm and a function objectCloser defined in the file Closer.h . The program should then examine each facility inorder of proximity and search for runways that belong to this facility (as identified by the sitenumber) and have a length larger than or equal to the minimum runway length required. Thissearch will use the STL find_if algorithm and a function object SiteNumber defined inthe file SiteNumber.h . For each facility (up to a maximum of 10 facilities) the program willprint the type, code, name, and distance from the current position, followed by a list of runwayshaving a sufficient length.You are given the files Facility.h and Runway.h which define classes that representfacilities and runways respectively. You should not modify these files. You must create the filesFacility.cpp and Runway.cpp to implement the member functions of the classesFacility and Runway . You are also given a file mayday.cpp which contains anincomplete implementation of the main function. You must add lines to the file mayday.cppto complete the implementation in three places identified with the comment// Insert your code hereThe comments preceding the above line indicate what must be implemented. You should notremove lines from the file mayday.cpp . You must create the files Closer.h andSiteNumber.h to include the definition of the corresponding function objects. You are alsogiven the files gcdistance.h and gcdistance.cpp that include the implementation of thecalculation of the distance between two locations on Earth specified by their latitudes andlongitudes. These two files should not be modified.Facility classThe member functions of the Facility class are defined as follows:Facility(string s)The constructor takes a single string argument. The argument s contains a full line read fromthe Facilities.txt file. The constructor should initialize the data members of Facilityby selecting the appropriate substrings from the argument. The latitude and longitude fieldsshould be converted to double values using the convert_latitude andconvertlongitude member functions. The sign of the latitude and longitude_data members should be determined by checking whether the latitude and longitude fields endwith N or S, and E or W respectively.string site_number(void) constThis function returns the facility’s site number.string type(void) constThis function returns the facility’s type.string code(void) constThis function returns the facility’s code.string name(void) constThis function returns the facility’s name.double latitude(void) constThis function returns the latitude of the facility in degrees decimal. Latitudes in the southernhemisphere are negative numbers.double longitude(void) constThis function returns the longitude of the facility in degrees decimal. Longitudes in the westernhemisphere are negative numbers.double distance(double lat, double lon) constThis function returns the distance in nautical miles between the facility and the position definedby (lat,lon) in degrees decimal. The implementation of this function uses the gcdistancefunction provided in files gcdistance.h and gcdistance.cpp .double convert_latitude(string s) constThis function converts the string s representing a latitude in seconds decimal to a double valuein degrees decimal. One degree is 3600 seconds. The sign of the result is positive if the string sends with N and negative if it ends with S . For example, the latitude represented by the string135427.7000N should be converted to the value 37.6188double convert_longitude(string s) constThis function converts the string s representing a longitude in seconds decimal to a doublevalue in degrees decimal. One degree is 3600 seconds. The sign of the result is positive if thestring s ends with E and negative if it ends with W . For example, the longitude represented bythe string 440551.5000W should be converted to the value -122.3754 .Runway classThe member functions of the Runway class are defined as follows:Runway(string s)The constructor takes a single string argument. The argument s contains a full line read fromthe Runway.txt file. The constructor should initialize the data members of Runway byselecting the appropriate substrings from the argument.string site_number(void) constThis function returns the site number of the facility that the runway belongs to.string name(void) constThis function returns the name of the runway.int length(void) constThis function returns the length of the runway in ft.int convert_length(string s) constThis function converts the string s representing a runway length to an int value in feet.Function objectsTwo function objects must be defined. The Closer function object (to be defined in the fileCloser.h) is used to sort facilities in order of proximity to the current location. TheSiteNumber function object (to be defined in the file SiteNumber.h) is used to find arunway having a given site number.Test programsThe test programs testFacility.cpp and testRunway.cpp are provided and should notbe modified. These programs will be used (with the corresponding input and output files) to testthat your implementation of the Facility and Runway classes is correct.HW4 AssignmentYour task is to implement the files Facility.cpp , Runway.cpp. , Closer.h ,SiteNumber.h , and complete the implementation in mayday.cpp . The filesFacility.h and Runway.h are provided and should not be modified. The Makefile isprovided and should not be modified. The mayday executable and other executables should bebuilt using the command$ makeDo not use C++11 or C++14 features in your source files.Test casesFive test cases of the mayday program are provided with corresponding output files. Shellscripts files named testmayday1.sh to testmayday5.sh are provided and include theinvocation of the mayday program with its command line arguments. The filestestmayday1.out to testmayday5.out contain the corresponding output.1) testmayday1.sh: Sacramento International AirportYou are flying over Sacramento International airport. Your position is (38.6954, -121.5910) andyou request a minimum landing length of 6000 ft.2) testmayday2.sh: Helicopter on downtown SacramentoYou are flying a helicopter over downtown Sacramento. Your position is (38.55, -121.49) andyou request a minimum landing length of 40 ft.3) testmayday3.sh: Flight 1549You are flying an Airbus A320 and just took off from New York La Guardia airport. You lostpower after hitting a flock of birds. Your position is (40.8615, -73.8775) and you request aminimum landing length of 6000 ft.4) testmayday4.sh: South Pacific OceanYou are flying over the South Pacific Ocean. Your position is (-15, -134) and you request aminimum landing length of 6000 ft.5) testmayday5.sh: Space Shuttle approach to CAYou are flying a Space Shuttle, approaching the California coast. Your position is (35, -123) andyou request a minimum landing length of 15000 ft.Two test cases for the programs testFacility and testRunway are also provided.Use the mayday executable and the testFacility and testRunway executables togetherwith the corresponding input and output files to check your implementation. Verify that yourprogram reproduces the test output exactly. Use the diff command to compare your output fileswith the reference test output files. Note that other test files may also be used when grading yourimplementation.SubmissionCreate a tar file named hw4.tar containing all the files needed to build the mayday ,testFacility and testRunway programs. In order to limit file size, do NOT include thefiles Facilities.txt and Runways.txt . Submit your project using:$ handin cs40 hw4 hw4.tar本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

相关文章

网友评论

      本文标题:C++代写 ECS40 Winter 2017代做C/C++编

      本文链接:https://www.haomeiwen.com/subject/pwiupqtx.html