Download presentation
Presentation is loading. Please wait.
1
Visual C++ Programming: Concepts and Projects
Chapter 7B: Arrays (Tutorial)
2
Tutorial: Classroom Seating
Problem Analysis Create a classroom seating chart Squares will represent seats Color code the seats to match student performance levels Red = below the mean Yellow = mean up to 90% Green = 90% or better Programming with Visual C++
3
Programming with Visual C++
Design Interface sketch Multiple rows of seats Seats are color-coded by student score Mean score is displayed in a TextBox Two buttons To display empty seats To display colored seats used to locate groupings Programming with Visual C++
4
Programming with Visual C++
Design (continued) Programming with Visual C++
5
Programming with Visual C++
Design (continued) Programming with Visual C++
6
Programming with Visual C++
Design (continued) Constants The number of rows and columns of seats Programming with Visual C++
7
Programming with Visual C++
Design (continued) Data table Instance variables Programming with Visual C++
8
Programming with Visual C++
Design (continued) Drawing objects Programming with Visual C++
9
Programming with Visual C++
Design (continued) Algorithm for btnShow_Click() Construct a seating chart Draw a rectangle in every column in each row Programming with Visual C++
10
Programming with Visual C++
Design (continued) Programming with Visual C++
11
Programming with Visual C++
Design (continued) Algorithm for btnGroup_Click() Programming with Visual C++
12
Programming with Visual C++
Design (continued) Trace sample data to test the algorithms The program maps a one-dimensional array of data into a two-dimensional array of seats Proceed one row at a time Process each column in that row Programming with Visual C++
13
Programming with Visual C++
Design (continued) Programming with Visual C++
14
Programming with Visual C++
Design (continued) Programming with Visual C++
15
Programming with Visual C++
Design (continued) Programming with Visual C++
16
Programming with Visual C++
Design (continued) Programming with Visual C++
17
Programming with Visual C++
Design (continued) Programming with Visual C++
18
Programming with Visual C++
Development Create the interface Code the constants and instance variables Code Form1_Load() Code btnShow_Click() Code btnGroups_Click() Programming with Visual C++
19
Development (continued)
Programming with Visual C++
20
Development (continued)
Code the constants and instance variables Programming with Visual C++
21
Development (continued)
Code Form1_Load() Programming with Visual C++
22
Development (continued)
Drawing the seats on the interface The horizontal distance between each seat is 75 pixels The vertical distance between each seat is 40 pixels Programming with Visual C++
23
Development (continued)
Programming with Visual C++
24
Development (continued)
Programming with Visual C++
25
Development (continued)
Code btnShow_Click() Programming with Visual C++
26
Development (continued)
Code btnGroups_Click() Before drawing the seats, the mean must be calculated and displayed Programming with Visual C++
27
Development (continued)
CalcMean() Accumulates the sum of the values in the array Divides by the number of array elements Programming with Visual C++
28
Development (continued)
Drawing the color-coded seats Programming with Visual C++
29
Programming with Visual C++
Testing Verify that interface matches Figure 7-17 Verify that the mean is correct Make sure that the seats are colored correctly to match the three levels of student performance Programming with Visual C++
30
Programming with Visual C++
On Your Own Display the highest score Display a count of scores above the mean Programming with Visual C++
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.