Question
Lab 8-3: Using Multidimensional Arrays In this lab, you will complete a C++ program that uses a two-dimensional array to store data for the Building
Lab 8-3: Using Multidimensional Arrays
In this lab, you will complete a C++ program that uses a two-dimensional array to store data for the Building Block Day Care Center. The program is described in Chapter 8, Exercise 10, in Programming Logic and Design. The day care center charges varying weekly rates depending on the age of the child and the number of days per week the child attends. The weekly rates are shown in Table 8-2.
The program should allow the user to enter the age of the child and the number of days per week the child will be at the day care center. The program should output the appropriate weekly rate. The file provided for this lab contains all of the necessary variable declarations, except the two-dimensional array. You need to write the input statements and the code that initializes the two-dimensional array, determines the weekly rate, and prints the weekly rate. Comments in the code tell you where to write your statements.
1. Open the source code file named DayCare.cpp using Notepad or the text editor of your choice.
2. Declare and initialize the two-dimensional array.
3. Write the C++ statements that retrieve the age of the child and the number of days the child will be at the day care center.
4. Determine and print the weekly rate.
5. Save this source code file in a directory of your choice, and then make that directory your working directory.
6. Compile the source code file DayCare.cpp. 7. Execute the program.
Here is the DayCare.cpp file information:
#include
int main() { // Declare two dimensional array here // Declare other variables int numDays; int age; int QUIT = 99; // This is the work done in the getReady() function // Perform a priming read to get the age of the child while(age != QUIT) { // This is the work done in the determineRateCharge() function // Ask the user to enter the number of days
// Print the weekly rate // Ask the user to enter the next child's age } // This is the work done in the finish() function cout
return 0; } // End of main() function
Age in Years 30.00 26.00 24.00 22.00 20.00 4 or more Table 8-2 Weekly rates for Lab 8-3 Days Per Week 60.00 88.00 52.00 70.00 67.00 46.00 40.00 60.00 35.00 50.00 115.00 96.00 89.00 75.00 66.00 140.00 120.00 110.00 88.00 84.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started