Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab 83: Using Multidimensional Arrays In this you will complete a C++ program th

ID: 3801381 • Letter: L

Question

Lab 83: Using Multidimensional Arrays In this you will complete a C++ program that uses a array to store data for the Building Block Care Center. The program described in Chapter 8, Exercise 10. in and Design. day care center charges weekly rates weekly on the age of the child and the number of days per week the child attends. The rates are shown in Table 8-2. Days Per Week Age in Years 30.00 60.00 88.00 115.00 140.00 26.00 52.00 70.00 96.00 120.00 24.00 46.00 67.00 110.00 22.00 40.00 60.00 75.00 88.00 4 or more 20.00 35.00 50.00 66.00 84.00 Weekly rates for Lab 83 Table 8-2 The program should allow the user to enter the age of the child and the number 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. l. 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. Determine and print the weekly rate. that directory Save this source code file in a directory of your choice, and then make your working directory. Compile the source code file Daycare.cpp. Execute the program.

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <fstream>

using namespace std;
void getReady(int QUIT,float arr[5][5]);
float determineRateCharge(int age,float arr[5][5]);
void finish();

int main(){
float arr[5][5] = { {30.00,60.00,88.00,115.00,140.00},
   {26.00,52.00,70.00,96.00,120.00},
   {24.00,46.00,67.00,89.00,110.00},
   {22.00,40.00,60.00,75.00,88.00},
   {20.00,35.00,50.00,66.00,84.00}};
   int numDays ;
   int age;
   int QUIT = 99;
   getReady(QUIT,arr);
  
   return 0;
}

void getReady(int QUIT,float arr[5][5]){
   int age;
   while (age != QUIT ){
       cout << "Age of the Child :" << endl;
       cin >> age;
   float weeklyCharges = determineRateCharge(age,arr);
   cout << "Weekly Charges :" <<weeklyCharges<< endl;
}
}

float determineRateCharge(int age,float arr[5][5]){
   int numDays ;
   float charges;
   cout << "Number of days child will be at day care center :" << endl;
   cin >> numDays;
   if(age >= 0 && age <= 3){
   charges = arr[age][numDays-1];
   } else if(age >= 4)
   charges = arr[4][numDays-1];
   return charges;
}

void finish(){
   cout << "End OF Program" << endl;  
}

-----------------------------------

OUTPUT:

Age of the Child :
2
Number of days child will be at day care center :
3
Weekly Charges :67
Age of the Child :
4
Number of days child will be at day care center :
3
Weekly Charges :50
Age of the Child :
5
Number of days child will be at day care center :
4
Weekly Charges :66
Age of the Child :
6
Number of days child will be at day care center :
1
Weekly Charges :20
Age of the Child :
99
Number of days child will be at day care center :
2
Weekly Charges :35

--------------------------------
Process exited after 23.49 seconds with return value 0
Press any key to continue . . .