Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include BirthAnalysis.h using namespace std; using std::string; using std::endl; using std::cout; bool testAnswer(const string &nameOfTest, double received, double expected); template bool testAnswer(const string

image text in transcribed

image text in transcribed

#include #include #include "BirthAnalysis.h" using namespace std; using std::string; using std::endl; using std::cout;

bool testAnswer(const string &nameOfTest, double received, double expected);

template bool testAnswer(const string &nameOfTest, const T& received, const T& expected);

int main() { { cout

testAnswer("numberOfBirths in Stanislaus_County", ba.numberOfBirths("Stanislaus_County"), 2); testAnswer("numberOfBirths in Sutter_County", ba.numberOfBirths("Sutter_County"), 3);

testAnswer("smallestBirthLength in Stanislaus_County", ba.smallestBirthLength("Stanislaus_County"), 46.2); testAnswer("smallestBirthLength in Sutter_County", ba.smallestBirthLength("Sutter_County"), 47.2);

// testAnswer("isUnderweightBirth in Stanislaus_County", ba.isUnderweightBirth("Stanislaus_County"), true); //testAnswer("isUnderweightBirth in Sutter_County", ba.isUnderweightBirth("Sutter_County"), false); } { cout

testAnswer("numberOfBirths in Calaveras_County", ba.numberOfBirths("Calaveras_County"), 81); testAnswer("numberOfBirths in Sutter_County", ba.numberOfBirths("Sutter_County"), 40);

testAnswer("smallestBirthLength in Calaveras_County", ba.smallestBirthLength("Calaveras_County"), 44.0); testAnswer("smallestBirthLength in Sutter_County", ba.smallestBirthLength("Sutter_County"), 44.5838);

//testAnswer("isUnderweightBirth in Calaveras_County", ba.isUnderweightBirth("Calaveras_County"), true); //testAnswer("isUnderweightBirth in Sutter_County", ba.isUnderweightBirth("Sutter_County"), true); } system("pause"); // uncomment to pause main program for testing in Visual Studio return (0); }

bool testAnswer(const string &nameOfTest, double received, double expected) { if ((received - expected) > -0.01 && (received - expected) bool testAnswer(const string &nameOfTest, const T& received, const T& expected) { if (received == expected) { cout

135593 cas Con 73526 program should read in such a s , and the calculate the answer to the follow ons the anc f or the above data is shown in parantheses How many birth t her in a given county? 2 in Stanislaus_County * What is the s t rength in a given county? (46.2 in Stanslaus_Court Were there any underweight births, less than 25 kg. in a given county by Stars County) Implement your loc a t alysis. The class should have the following public member functions Birthnalysis the default constructor radite string files function that takes in the filename of the data and reads in the data to its member variables. All file reading should take place only in this function (Do not open the file in any other member function) int numberOfBirths (string county returns the number of births in the given . double llest Birthength string county returns the smallest birth length in the given county. If there are no births, return -1. bool isUnderweightBirth Istring county : returns true if there was an under weight birth, ie..

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions