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

please follow the instruction above and make changes in following program. Lab 8

ID: 3727492 • Letter: P

Question

please follow the instruction above and make changes in following program.

Lab 8 Redo Lab 6 with the following changes 1. Each function goes in a separate cpp file. The file name is the name of the function. 2. Each unction prototype goes in a separate h file, named as n #1 above. For exam e f your function Fis delined in F p the prototype should be placed in Fh. 3. Each function is defined in the namespace "NLC". 4. Only the main program should remain in the original cpp fie. 5. Modify the main program to include the header fies. 6. Modify the main program to account for the namespace you have creatod. Checklist 1. Project/solution named correctiy 2. Correct comments at top 3. Consistent indentation (Use Edit/Advanced/Format Document 4. Good variable names 5. Overall neat organization 6. Comments in code explain what's being done 7. Each function .opp file should include the corresponding h file Lab 9 1. Crea ate a class called Square using separate h and epp files. Squares look something like this when drawn:

Explanation / Answer

//Largest.h

double Largest(double numbers[], int size);

//Smallest.h

double Smallest(double numbers[], int size);

//Largest.cpp

#include "Largest.h"

namespace NLC

{

double Largest(double numbers[], int size)

{

double max = numbers[0];

for (int i = 0; i < size; i++)

{

if (numbers[i] > max)

max = numbers[i];

}

return max;

}

}

//Smallest.cpp

#include "Smallest.h"

namespace NLC

{

double Smallest(double numbers[], int size)

{

double min = numbers[0];

for (int i = 0; i < size; i++)

{

if (numbers[i] < min)

min = numbers[i];

}

return min;

}

}

//main.cpp

#include<iostream>

#include "Largest.cpp"

#include "Smallest.cpp"

using namespace std;

int main(){

double numbers[] = {4.5, 3.4, 5.6, 9.1, 6.7,7.8};

int count = sizeof(numbers)/sizeof(double);

cout<<NLC::Largest(numbers, count)<<endl;

cout<<NLC::Smallest(numbers, count)<<endl;

return 0;

}