美文网首页
C代写 CS 1050 :Homework Assignment

C代写 CS 1050 :Homework Assignment

作者: gaitingzhou | 来源:发表于2019-04-24 21:25 被阅读0次

    IntroductionC语言练习题,涉及一个用在控制台操作的航班订票和查询系统,主要涉及的知识有文件的读取和对二维数组的操作。用二维数组表示航班的座位信息,开始运行时从文件读取二维数组的大小和数据,然后显示菜单供用户操作,根据用户的输入执行航线和座位的选择。RequirementCS 1050 Homework Assignment 2JOE’S AIRLINE RESERVATION SYSTEMFall-2016Due : 14 th October, Friday 5:00 PM (No Extension). Submission system shuts off at 5pm.DirectionsComplete the following homework assignment using the description given in each section.IMPORTANT INFOtc.rnet will be down for maintenance during the course of the week of 10/3, it is anticipatedto be back up quickly but in order to be safe there is a temporary server created to work on hw2,which will be taken down as soon as the former is back up and running. So in order to not lose yourcode follow the instructions.Logging in to the new server:Putty: hostname =  test.rnet.missouri.eduTerminal on a mac: ssh Notice the change of server, you will be logging into a different server (test.rnet.missouri.edu) andnot your original server (tc.rnet.missouri.edu).USE FTP clients like FileZilla or WinSCP to back up your files to your local machine. The test.rnetserver is a temporary one and will be take down during the week of 10/3 after tc.rnet is back,unfortunately we have no control over the timings, so whenever you code something make sure youkeep backing the file up immediately on your local machine. Like, every 15 minutes or once youfinish one function or whenever you quit out of test.rnet.Once you get an announcement on BLACKBOARD from DHEERAJ, saying “tc.rnet is back andrunning” move the local copy to tc.rnet server. Again, by using FTP.After that, Log into putty / terminal again usingtc.rnet.missouri.edu as the new host name and continue the way you have been doing it all thiswhile and submit it from here only. You cannot submit from test.rnet.missouri.edu.I really hope you know how to use ftp or file transfer by now. All the TAs have spoken at least twiceabout it in the labs.Submission information:Submit the assignment by the due date using the similar submission command as used for labsPlease include your lab section in the file name.This will work only when you are on tc.rnet.missouri.edu and not on test.rnetFilename must be: sectionletter-hw2.c (Include your respective lab section)e.g. m-hw2.c$ submit $ submit CS1050 HW2 m-hw2.cPurpose: Learn to use multiple types of two-dimensional arrays for data input and access. Use character arrays and strings and perform. string manipulation. Learn to develop a complex menu system. Learn the importance of using functions.DescriptionThanksgiving Break is fast approaching, so, we hereby present Mizzou’s state-of-the-art onlineticket booking system, Joe’s Airline Reservation System. Which will be developed by you. Thisapplication helps in reserving flight seats. This is done via implementing the 8 user-definedfunctions as explained below.Your program must print a menu for the user to select what he needs to do with the application.There will be admin mode which requires log-in via a passcode. There will be an option forreserving a seat on a flight. Third option is to exit the application.A file templateHW2.c is attached on Blackboard which will guide you on how to start theprogram and what are the global variables you need to use and how. You can follow that.Comments and prototypes have been given for you to help you out in the process.GLOBAL CONSTANTS and VARIABLES:#define ROW 6 //for row length#define COL 4 //for column length#define MAX 25 // for stringsFunctions to implement:1. void initialSeats(char flight[][COL], int count);The initialSeats function takes in a two-dimensional char array created in main. It will initializeall array elements to the character ‘O’. ‘O’ symbolizes the seat on the plane is open and can betaken. The int count variable is used to symbolize the number of people who already have a seaton the plane, this is a random number generated and sent from main. In this function it willrandomly create and assign an index in the two-dimensional array with the character ‘X’ for eachperson up to value of count. ‘X’ is used to symbolize that an element in the two dimensionalarray is occupied. This will be used later on in the program. MAKE SURE TO SEED RAND inMAIN. Below is the way to randomly generate the seats for each passenger to take. Thisfunction should be called as soon as your program starts.Keep in mind the possibility of the randomized index overwriting ‘X’, if it was already there.You have to handle that case. Beware!!int row = rand() % ROW;int col = rand() % COL;2. void displayMenu();Prints the display options. Admin mode, Reserve a seat and Exit. This is the main menu.3. void printFlightMap(char flight[][COL]);The printFlightMap function is printing off a two-dimensional character array. Thus, printing offthe characters stored in each index of the two-dimensional array either ‘O’ or ‘X’. As notedabove the ROW and COL are #defined in your program, use them. For loops are your friendshere. Called in admin mode and during reserving a seat (specifically in seatReservation).4. int loginMatch(int passcode, int adminPasscode);The loginMatch function is called to compare the passcodes, the function returns 1 if both matchand 0 if there is no match. This is called in admin mode. Should prompt for the passcode entryuntil the passcode matches. The adminPasscode is specified, everyone should use the sameadminPassocde, then compare that with the passcode user enters in main() when they wish tolog-in.5. int getTotalRevenue(char f1[][COL], char f2[][COL], char f3[ ][COL]);Note: f1, f2, f3 are flight1, flight2, flight3, just shorthanded.The getTotalRevenue function will take in all three two-dimensional character arrays created inmain and calculate the total revenue using the costMatrix two dimensional array. With each two-dimensional array f1, f2, and f3, search for the character ‘X’ stored in them, upon finding theindex of the character ‘X’, use the index to reference inside of the global two-dimensional arraycostMatrix (look above in Constants and Global Variables). While inside of costMatrix array,add the value stored in the two-dimensional array with a running total variable (Hint use +=).The function will return the total revenue earned thus far from seats reserved in all 3 flights. So,you will need nested for-loops. This is called only in admin mode.6. void flightMenu();Prints the three flight options as shown. Flights to Miami, Nashville and Las Vegas. This is donewhen reserve a seat option is chosen.7. void seatReservation(char flight[][COL]);The seatReservation function takes in a two-dimensional array and allows the user to reserve anindex on the two-dimensional array. Before any reserving is done, this function calls theprintFlightMap function mentioned earlier to allow the user to see the already populated two-dimensional array for that flight. Then, the user is asked to enter a row and column to reserve aseat. Additionally, this function will have built in error checking (look below at outputexample) Once the user has inputted a correct index within [0, ROW) and [0, COL) in the two-dimensional array, this function needs to check if that index entered is already taken in the two-dimensional array with the character ‘X.’ If the index is populated with ‘X’, an error will beshown to the user (look at the output below) and have them re-enter a new possible row andcolumn again. If the index entered is not filled with ‘X’, then assign that index with ‘X’, i.e.changing the element from ‘O’ to ‘X’. Before the function ends, it will call the functionprintFlightMap again and prints a success message.Remember, rows run from 0-5 and columns from 0-3. Error check for this too.8. void printMessage(char name[],char num[]);//DO THIS, IF YOU ARE DOING THE BONUSThis function is called for each flight option after the seatReservation() is called. It takes in twostrings, name of passenger and the flight number for that particular case. Both are characterarrays (strings). For flight Cou->Miami number must be set as “MIA1050”, for Cou->Nashvillenumber must be set as “BNA1050”, for flight Cou->Las Vegas num must be set as “LAS1050”,this must be done in main and the name and particular number must be sent to this function.Once in this function, you will merge (important part) the two strings into third string and printthat as the e-Ticket as shown below and print a confirmation message.Eg1: name is “Fred” number is “MIA1050”, your merged string should be FMrIeAd1050. Printthis as the booking confirmation number.Eg2: name is “Guilliams” number is “LAS1050”, you merged string should beGLuAiSl1l0i5a0ms.Eg3: name is “Christopher” number is “BNA1050”, your merged string should beCBhNrAi1s0t5o0pher9. int main(void)The main function will be doing all (most of) the function calls. In main, you need to create fourcharacter arrays of flight_1[ROW][COL], flight_2[ROW][COL], flight_3[ROW][COL], andstrings name[MAX],flight_number[MAX]adminPasscode= 105016; // everyone must keep this the sameAlso, before you call initialSeats function on all the flights arrays individually, make sure to findhow many people already reserved seats. This is done by creating a local variableseats = rand % 5 + 1 (this is your int counts in initialSeats function), rand()%5 +1 will give arandom number between 1-5; you only need to do this once. A menu system will be displayed forthe users to run specific parts of the program (See output below of what the menu system needsto look like). Make sure to implement error checking for invalid input!On the main menu, the user will see a display of options: The options are 1: Admin Portal, 2:Reserve a seat on a flight, and 3: Quit. The menu will need to loop until the exit option ischosen.To access the Admin Portal, the user enters a 1, and then must type a passcode that will bestored in a variable. Now, verify the passcode, call the loginMatch function (you shouldcompare) with passcode and adminPasscode to verify if it is an authentic log-in attempt. If thepair match, that is, they are equivalent then it means successful log-in. Upon successfulverification, inside of the admin portal, call printFlightMap on each flight array andgetTotalRevenue (See output below). Declare these variables in main().To access Reserve a seat, the user enters a 2. Inside of this portal, the user is displayed the threeflights that can be accessed to book a seat. (See below output). As always, verify the user inputfor flight option (1-5). 2 character arrays will be used, name and flight_number. Once a validflight option is chosen. Switch to that particular case and ask for the user’s first name and storeit in name[] and store the flight numbers (MIA1050,BNA1050,LAS1050) in flight_number[] asspecified above for that flight. Then, send the corresponding flight array to seatReservation,after successful reservation the user will be relocated back to the main menu. Then print asuccess message using name and fligh_number, just to confirm the booking.Must be done for each case (each flight).Then, if you are doing the bonus, call the printMessage with name[] and that particularflight_number[],. Note: flight1 is Miami, flight2 is Nashville, flight3 is Las Vegas.Please go through Sample Output and the document clearly before starting out.Sample OutputCharacter in bold are inputs from the user. Yours will vary but the outline must look similar. It is big,don’t worry, but will help give you a better idea. I have run it twice completely, that’s why it is 10pages.本团队核心人员组成主要包括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代写 CS 1050 :Homework Assignment

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