Page 1 of 12 CMIS 102 Hands-On Lab Week 8 - Concerts Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description,...

1 answer below »
Code to use and modify is on pages 9-10, tasks for the assignment are on page 11. I'm really just looking for the code to be modified, I can run the code myself and do test cases. Also, this assignment really doesn't need any reference style. I haven't styled any assignment based on APA, so don't worry about it.


Page 1 of 12 CMIS 102 Hands-On Lab Week 8 - Concerts Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, and implementation with C code. The example provided uses sequential, repetition, selection statements, functions, strings and arrays. Program Description Compute the value of the ticket sales for concerts and the total sales for a series of concerts. Then display the concert information in a sorted list. Technologies used in this project:  strings stored as char arrays  2 dimensional char and int arrays  getting data from the user into the various arrays  using only part of an array for valid data  computing array arithmetic – vector inner products to compute a value  sorting using selection sort  displaying data in arrays Interaction Outline: 1. Get the ticket price for each 3 categories. a. float float float 2. Get the band name and numbers of fans for each category of each concert. a. String int int int b. NOTE: spaces are not allowed in the band names, so use underscores instead of spaces. c. Period will end the input. 3. Internal computations: a. Compute the value of the sales for each concert. b. Compute the total value of the ticket sales. c. Sort the concerts by value of the ticket sales. 4. Display the resulting data in a nice format. Notes: 1. This program is not expected to behave nicely if the input does not follow the specifications above. 2. All numbers this program will handle should be of moderate size. The exact meaning of moderate is made precise by the data types, print statements, and array sizes. Page 2 of 12 Analysis 1. Since we are going to do sorting, we will need to hold the data in arrays. 2. We will use functions to simplify the code, and reflect a modular approach to the design of the project. 3. We will use global variables to reduce the amount information transferred in parameter lists. 4. We will use a fixed number of categories, but let the number of concerts by determined by the user at run time, up to a maximum value. 5. The user will end inputting the group information with a flag value, a period. 6. Basic data types a. ticket prices – float b. name of concert/band – char array c. number of concerts and number of fans in each category at each concert – int d. number of concerts – int. e. value of tickets – float 7. We will use nested loops to handle most operations: a. reading the ticket prices b. reading the group name and attendance c. computing the value of the ticket sales d. printing the array of data e. sorting the arrays by the value of the ticket sales Page 3 of 12 Pseudo-code: Global variables:  Constants using define declarations o MAXN – the maximum number of characters in a band name o MAXG – the maximum number of concerts/bands/groups o MAXC – the maximum number of categories  Arrays: o char group [MAXG][MAXN] – the name of each group o int fans [MAXG][MAXC] – the number of fans at a concert by category o float prices [MAXC] – the ticket price of each category o float sales [MAXG] – the total value of the tickets for each concert  int count o the actual number of active concerts/bands/groups o this number is determined at run time in the getData function o used throughout the rest of the program to only look at data in the group, fans and sales arrays that is actually active. Pseudo-Code: 1. main a. getData – get ticket prices by category & get data for the concerts b. computeSales – compute sales for each concert c. printArray – print raw concert data d. sortBySales – sort the concerts by value of sales, use selection sort i. findMinSales – find min sales in unsorted rest of array ii. switchRows – as needed e. printArray – print sorted concert data 2. getData a. prompt for ticket prices b. get ticket prices into prices array c. prompt for band name and fans in each category at each concert d. insert data into appropriate arrays, ending with a period i. loop on concert 1. get group name 2. loop inside on number of categories 3. computeSales a. for each group i. sales for that group = 0 ii. for each category 1. sales = sales + price of category * number of fans in that category Page 4 of 12 2. 4. printArray a. print column headers b. for each group i. print the group name ii. for each category 1. print the number of fans in that category iii. print the sales for that concert/group 5. sortBySales a. COMMENTS: for each row (group + fans + sales) i. for each row index, starting at index 0 ii. the rows that have indices less than the current index are sorted, and are already the smallest sales elements in the entire data set. iii. thus, the next step is to find the smallest sales row in the remaining elements and switch that row with the current index row b. for index = 0 to number of active rows, step index by 1 i. target = findMinSales (index) ii. if target not equal to index, switchRows (target, index) 6. findMinSales (index) a. set target as index b. min c. for the rest of the array, starting at index+1, indexing by i i. if sales [i] < min 1. target = i 2. min = sales [target] d. return target 7. switchrows (m, n) a. temporary locations i. char tc ii. int ti iii. float v b. switch group names by stepping through all the letters (i) in each char array: i. tc = group [m][i] ii. group [m][i] = group [n][i] iii. group [n][i] = tc c. switch fan entries, stepping by (i) over the fans array: i. ti = fans [m][i] ii. fans [m][i] = fans [n][i] iii. fans [n][i] = ti d. switch sales: i. v = sales [m] ii. sales [m] = sales [n] iii. sales [n] = v page 5 of 12 test plan to verify this program is working properly a variety of test cases should be used. the following is just one test case, which only tests a very few aspects of the program. you should be thinking about other data sets to test other aspects of the program, and also create more realistic test sets. test case input actual output using repl.it – user input in red: 1 1 2 3 a 1 2 3 b 3 3 1 c 5 3 1 d 3 3 5 e 1 1 2 f 9 4 3 g 4 5 6 . enter ticket prices in each of 3 cateogories: 1 2 3 -- enter group and fans in 3 categories . to finish entries: a 1 2 3 b 3 3 1 c 5 3 1 d 3 3 5 e 1 1 2 f 9 4 3 g 4 5 6 . concert s1 s2 s3 sales a 1 2 3 14.00 b 3 3 1 12.00 c 5 3 1 14.00 d 3 3 5 24.00 e 1 1 2 9.00 f 9 4 3 26.00 g 4 5 6 32.00 --- sorted --- concert s1 s2 s3 sales e 1 1 2 9.00 b 3 3 1 12.00 c 5 3 1 14.00 a 1 2 3 14.00 d 3 3 5 24.00 min="" 1.="" target="i" 2.="" min="sales" [target]="" d.="" return="" target="" 7.="" switchrows="" (m,="" n)="" a.="" temporary="" locations="" i.="" char="" tc="" ii.="" int="" ti="" iii.="" float="" v="" b.="" switch="" group="" names="" by="" stepping="" through="" all="" the="" letters="" (i)="" in="" each="" char="" array:="" i.="" tc="group" [m][i]="" ii.="" group="" [m][i]="group" [n][i]="" iii.="" group="" [n][i]="tc" c.="" switch="" fan="" entries,="" stepping="" by="" (i)="" over="" the="" fans="" array:="" i.="" ti="fans" [m][i]="" ii.="" fans="" [m][i]="fans" [n][i]="" iii.="" fans="" [n][i]="ti" d.="" switch="" sales:="" i.="" v="sales" [m]="" ii.="" sales="" [m]="sales" [n]="" iii.="" sales="" [n]="v" page="" 5="" of="" 12="" test="" plan="" to="" verify="" this="" program="" is="" working="" properly="" a="" variety="" of="" test="" cases="" should="" be="" used.="" the="" following="" is="" just="" one="" test="" case,="" which="" only="" tests="" a="" very="" few="" aspects="" of="" the="" program.="" you="" should="" be="" thinking="" about="" other="" data="" sets="" to="" test="" other="" aspects="" of="" the="" program,="" and="" also="" create="" more="" realistic="" test="" sets.="" test="" case="" input="" actual="" output="" using="" repl.it="" –="" user="" input="" in="" red:="" 1="" 1="" 2="" 3="" a="" 1="" 2="" 3="" b="" 3="" 3="" 1="" c="" 5="" 3="" 1="" d="" 3="" 3="" 5="" e="" 1="" 1="" 2="" f="" 9="" 4="" 3="" g="" 4="" 5="" 6="" .="" enter="" ticket="" prices="" in="" each="" of="" 3="" cateogories:="" 1="" 2="" 3="" --="" enter="" group="" and="" fans="" in="" 3="" categories="" .="" to="" finish="" entries:="" a="" 1="" 2="" 3="" b="" 3="" 3="" 1="" c="" 5="" 3="" 1="" d="" 3="" 3="" 5="" e="" 1="" 1="" 2="" f="" 9="" 4="" 3="" g="" 4="" 5="" 6="" .="" concert="" s1="" s2="" s3="" sales="" a="" 1="" 2="" 3="" 14.00="" b="" 3="" 3="" 1="" 12.00="" c="" 5="" 3="" 1="" 14.00="" d="" 3="" 3="" 5="" 24.00="" e="" 1="" 1="" 2="" 9.00="" f="" 9="" 4="" 3="" 26.00="" g="" 4="" 5="" 6="" 32.00="" ---="" sorted="" ---="" concert="" s1="" s2="" s3="" sales="" e="" 1="" 1="" 2="" 9.00="" b="" 3="" 3="" 1="" 12.00="" c="" 5="" 3="" 1="" 14.00="" a="" 1="" 2="" 3="" 14.00="" d="" 3="" 3="" 5="">
Answered Same DayMar 07, 2021

Answer To: Page 1 of 12 CMIS 102 Hands-On Lab Week 8 - Concerts Overview This hands-on lab allows you to follow...

Mohd answered on Mar 08 2021
126 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here