Write a program that can be used by a ski resort to keep track of the local snow conditions for one week. It should have seven-element array of structures or class objects, where each structure or object holds a date and the number of inches of snow in the base on that date. The program should have the user input the name of the month, the starting and ending date of the seven-day period being measured, and then the seven base snow depths. The program should then sort the data in the ascending order by base depth and display the results (two functions one for sorting and one for displaying the results). Here is the beginning of a sample report. Snow Report December 12-18 Date Base 13 42.3 12 42.5 14 42.8
Microsoft Word - BCS230_Lab8_handout_93172.docx Lab08-BCS230,M.Alrajab 1 BCS230 Lab8HandoutandAssignment This lab handout provides two tasks that students are required to attempt during lab session. Lab objectives are for students to practice with: - Arrays and Arrays of Objects. - Classes and Objects. - Searching and Sorting. Task1: Charge account validation Modify the provided shell code to create a program that lets the user enter a charge account number. The program should determine if the number is valid by checking for it in the following list: 5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 8080152, 4562555, 5552012, 5050552, 7825877, 1250255, 1005231, 6545231, 3852085, 7576651, 7881200, 4581002, Initialize a one-dimensional array with these values. Then use a simple linear search to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message saying that number is valid. If the user enters a number no in the array, the program should display a message indicating it is invalid. Complete: ToDo 1: Read the input values. ToDo 2: Search for a specific value ToDo 3: Print if found #include
usingnamespacestd; boolsearchList(long[],int,long);//Functionprototype constintSIZE=18; intmain() { longaccounts[SIZE]= {5658845,4520125,7895122,8777541, 8451277,1302850,8080152,4562555, 5552012,5050552,7825877,1250255, 1005231,6545231,3852085,7576651, 7881200,4581002,}; longacctNum; cout< "please="" enter="" a="" 7-digit="" account="" number:="" ";="" todo="" 1:="" read="" the="" input="" value="" todo="" 2:="" check="" if="" the="" account="" number="" is="" valid="" todo="" 3:="" print="" if="" found="" return="" 0;="" }="" bool="" searchlist(long="" list[],="" int="" numelems,="" long="" value)="" {="" bool="" found="false;" todo="" provide="" implementation="" of="" the="" linear="" search="" here="" return="" found;="" }="" lab08="" -="" bcs230,="" m.="" alrajab="" 2="" task2:="" modify="" the="" selectionsort="" function="" presented="" in="" ppt="" lecture="" notes="" so="" it="" sorts="" an="" array="" of="" strings="" instead="" of="" an="" array="" of="" ints.="" test="" the="" function="" as="" stated="" in="" the="" shell="" code="" below.="" complete:="" todo="" 1:="" using="" selectionsort="" complete="" the="" function="" implementation="" todo="" 2:="" convert="" the="" string="" to="" uppercase="" todo="" 3:="" print="" all="" elements="" in="" the="" array.=""> #include #include usingnamespacestd; //Functionprototype voidselectionSort(string[],int); stringupperCaseIt(conststring); voiddisplayNames(conststring[],int); intmain(){ constintSIZE=20; //Setupthearrayofstrings,inthiscasenames stringname[SIZE]= {"Collins,Bill","Smith,Bart","Michalski,Joe","Griffin,Jim", "Sanchez,Manny","Rubin,Sarah","Taylor,Tyrone","Johnson,Jill", "Allison,Jeff","Moreno,Juan","Wolfe,Bill","Whitman,Jean", "Moretti,Bella","Wu,Hong","Patel,Renee","Harrison,Rose", "Smith,Cathy","Conroy,Pat","Kelly,Sean","Holland,Beth"}; //Callafunctiontosortthestrings selectionSort(name,SIZE); //Callafunctiontodisplaythe(nowsorted)strings cout<"thenamesinsortedorderare:\n\n"; displaynames(name,size); return0; } voidselectionsort(stringname[],intnumstrings){ intstartscan,minindex; stringminvalue; //todo1:sortthestrings } stringuppercaseit(conststringstringin){ strings=stringin;//localcopyofstringinwe'lluppercase //todo2:convertthestringtouppercase returns; } voiddisplaynames(conststringname[],intnumnames){ //todo3:printallelements(numnames)ofthestringarray(name) } lab08-bcs230,m.alrajab 3 lab8–assignment. what to hand-in problem: write a program that can be used by a ski resort to keep track of the local snow conditions for one week. it should have seven-element array of structures or class objects, where each structure or object holds a date and the number of inches of snow in the base on that date. the program should have the user input the name of the month, the starting and ending date of the seven-day period being measured, and then the seven base snow depths. the program should then sort the data in the ascending order by base depth and display the results (two functions one for sorting and one for displaying the results). here is the beginning of a sample report. snow report december 12-18 date base 13 42.3 12 42.5 14 42.8 submissioninstructions • test your code before submission. • you should have either a class or a structure. • add comments to explain your solution. • due date is wed april/03/2018 @ 11:59pm • you are allowed to submit late with -5% per day. • submission will not be available after friday april/06/2018 @ 11:59pm. • if you have more than one submission the late will be graded. • check rubric. "the="" names="" in="" sorted="" order="" are:="" \n\n";="" displaynames(name,="" size);="" return="" 0;="" }="" void="" selectionsort(string="" name[],="" int="" numstrings="" ){="" int="" startscan,="" minindex;="" string="" minvalue;="" todo="" 1:="" sort="" the="" strings="" }="" string="" uppercaseit(const="" string="" stringin){="" string="" s="stringIn;" local="" copy="" of="" stringin="" we'll="" uppercase="" todo="" 2:="" convert="" the="" string="" to="" uppercase="" return="" s;="" }="" void="" displaynames(const="" string="" name[],="" int="" numnames){="" todo="" 3:="" print="" all="" elements="" (numnames)="" of="" the="" string="" array="" (name)="" }="" lab08="" -="" bcs230,="" m.="" alrajab="" 3="" lab8="" –="" assignment.="" what="" to="" hand-in="" problem:="" write="" a="" program="" that="" can="" be="" used="" by="" a="" ski="" resort="" to="" keep="" track="" of="" the="" local="" snow="" conditions="" for="" one="" week.="" it="" should="" have="" seven-element="" array="" of="" structures="" or="" class="" objects,="" where="" each="" structure="" or="" object="" holds="" a="" date="" and="" the="" number="" of="" inches="" of="" snow="" in="" the="" base="" on="" that="" date.="" the="" program="" should="" have="" the="" user="" input="" the="" name="" of="" the="" month,="" the="" starting="" and="" ending="" date="" of="" the="" seven-day="" period="" being="" measured,="" and="" then="" the="" seven="" base="" snow="" depths.="" the="" program="" should="" then="" sort="" the="" data="" in="" the="" ascending="" order="" by="" base="" depth="" and="" display="" the="" results="" (two="" functions="" one="" for="" sorting="" and="" one="" for="" displaying="" the="" results).="" here="" is="" the="" beginning="" of="" a="" sample="" report.="" snow="" report="" december="" 12-18="" date="" base="" 13="" 42.3="" 12="" 42.5="" 14="" 42.8="" submission="" instructions="" •="" test="" your="" code="" before="" submission.="" •="" you="" should="" have="" either="" a="" class="" or="" a="" structure.="" •="" add="" comments="" to="" explain="" your="" solution.="" •="" due="" date="" is="" wed="" april/03/2018="" @="" 11:59pm="" •="" you="" are="" allowed="" to="" submit="" late="" with="" -5%="" per="" day.="" •="" submission="" will="" not="" be="" available="" after="" friday="" april/06/2018="" @="" 11:59pm.="" •="" if="" you="" have="" more="" than="" one="" submission="" the="" late="" will="" be="" graded.="" •="" check="">"thenamesinsortedorderare:\n\n"; displaynames(name,size); return0; } voidselectionsort(stringname[],intnumstrings){ intstartscan,minindex; stringminvalue; //todo1:sortthestrings } stringuppercaseit(conststringstringin){ strings=stringin;//localcopyofstringinwe'lluppercase //todo2:convertthestringtouppercase returns; } voiddisplaynames(conststringname[],intnumnames){ //todo3:printallelements(numnames)ofthestringarray(name) } lab08-bcs230,m.alrajab 3 lab8–assignment. what to hand-in problem: write a program that can be used by a ski resort to keep track of the local snow conditions for one week. it should have seven-element array of structures or class objects, where each structure or object holds a date and the number of inches of snow in the base on that date. the program should have the user input the name of the month, the starting and ending date of the seven-day period being measured, and then the seven base snow depths. the program should then sort the data in the ascending order by base depth and display the results (two functions one for sorting and one for displaying the results). here is the beginning of a sample report. snow report december 12-18 date base 13 42.3 12 42.5 14 42.8 submissioninstructions • test your code before submission. • you should have either a class or a structure. • add comments to explain your solution. • due date is wed april/03/2018 @ 11:59pm • you are allowed to submit late with -5% per day. • submission will not be available after friday april/06/2018 @ 11:59pm. • if you have more than one submission the late will be graded. • check rubric.>