Home Chemistry Questions and Answers

CMIS 102 Hands-On Lab Week 8 – Concerts & Ticket Sales by Emad Raza

Course
Mechanical Engineering

Subject
Chemistry

Category
Questions and Answers

Pages
35

Uploaded By
ATIPROS

Weighted Average 1.Demonstrate you successfully followed the steps in this lab by preparing screen captures of you running the lab as specified in the Instructions above. Test Case 1 2 The code executed is as follows: /*File: ticketSales.cpp * Date: March 09, 2019 * Author: Emad Raza * Purpose: To create a program that can calculate ticket sales and sort them appropriately. */ #include #define MAXN 100 // max characters withinin a groups. #define MAXG 50 // max number of groups. #define MAXC 3 // max categories //Declare Variables char group [MAXG][MAXN]; int fans [MAXG][MAXC]; float prices [MAXC]; float sales [MAXG]; int count = 0; void printArray () { printf ("%15s%5s%5s%5s%10s\n", "Concert", "s1", "s2", "s3", "Sales"); for (int i = 0; i < count; i++) { printf ("%15s", group [i]); for (int j = 0; j < MAXC; j++) { printf ("%5d", fans[i][j]); } // end for each category printf ("%10.2f\n", sales [i]); } // end for each group } // end function printArray void computeSales () { for (int i = 0; i < count; i++) { sales [i] = 0; for (int j = 0; j < MAXC; j++) { sales [i] += prices [j] * fans [i][j]; } // end for each category } // end for each group } // end function computeSales void switchRows (int m, int n) { char tc; int ti; float v; // printf ("Switching %d with %d\n", m, n); for (int i = 0; i < MAXN; i++) { 3 tc = group [m][i]; group [m][i] = group [n][i]; group [n][i] = tc; } // end for each character in a group name for (int i = 0; i < MAXC; i++) { ti = fans [m][i]; fans [m][i] = fans [n][i]; fans [n][i] = ti; } // end for each fan category v = sales [m]; sales [m] = sales [n]; sales [n] = v; } // end switch int findMinSales (int m) { float min = sales [m]; int target = m; for (int i = m+1; i < count; i++){ if (sales [i] < min) { min = sales [i]; target = i; } // end new max found } return target; } //
Read More

Preview 5 out of 35 Pages

Emad_Raza___Lab_8_V2.0.pdf.pdf prev1730998893672cf26db4d87.png

Download all 35 pages for $ 13.00

Reviews (0)

$ 13.00


Seller

Joined: 8 months ago

Document sold: 0

Reviews received
1
0
0
0
0

Send Message
Document Information
Buy Document

$13.00