Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This lab requires you to use C++ class composition to implement a single pole-filter design program. The program will allow the user to specify resistor

This lab requires you to use C++ class composition to implement a single pole-filter design program. The program will allow the user to specify resistor and capacitor values and filter type. Once all the user parameters are specified, the program will return the cutoff frequency values for the filter.

You are required to use two component classes: one for a resistor object and one for a capacitor object. You are then to define and implement a filter class that will contain one object of each the resistor and the capacitor classes in order to create the filter and its characteristics.

The lab also requires you to implement your program in a multiple-file project and create both cpp and h files for each class defined

Filter-Class Definition

The Filter class should have, at a minimum, the following capabilities.

A resistor-object data member

A capacitor-object data member

A cutoff frequency (in Hertz) of the Band pass RC filter (maximum and minimum cutoff frequencies), these 2 values are calculated based on the maximum and minimum in-tolerance values of the capacitor and the resistor object

A filter type, either low pass or high pass

Allow the user to enter new values for the filter, including

Resistor tolerance and nominal resistance.

Capacitor tolerance and nominal capacitance.

filter type

STEP 3: Test-Program Operation

All data-input and data-display operations (cin and cout) should be done in the function main() test program. The test program should instantiate at least one object of the class Filter.

a. The user should enter values for all the data members of the Filter, Resistor, and Capacitor classes.

b. The Filter class should then calculate and display the correct maximum and minimum cutoff frequencies.

3. The test program should then display all Filter, Resistor, and Capacitor data members.

Notes:

The cutoff frequency of a single pole RC filter fc=1/(2*?* R * C), where R is the resistance and C is the Capacitance

For R and C, you will have to calculate Rmax, Rmin, Cmax and Cmax

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

assign the following values to the data members as shown below:

for the resistor Object:

nominal= 50000

tolerance= 0.05

"when you create a resistor object, make sure to use the values listed above"

for the capacitor Object:

nominal= 0.00000006

tolerance= 0.1

"when you create a capacitor object, make sure to use the values listed above"

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

Starter Code:

Capacitor.h:

#ifndef CAPACITOR_H

#define CAPACITOR_H

#include

using namespace std;

class Capacitor{

private:

double tolerance, nominal;

double minCapacitance, maxCapacitance;

public:

Capacitor(double, double);

~Capacitor(){}

double getMinCapacitance();

double getMaxCapacitance();

double getTolerance();

double getnominal();

};

#endif

Filter.h:

#ifndef FILTER_H

#define FILTER_H

#include "Resistor.h"

#include "Capacitor.h"

#include

class Filter{

private:

string FilterType;

double minFreq, maxFreq;

Resistor R;

Capacitor C;

public:

Filter(string, Resistor, Capacitor);

~Filter();

double getMinFreq();

double getMaxFreq();

string getFilterType();

};

#endif

Resistor.h:

#ifndef RESISTOR_H

#define RESISTOR_H

#include

using namespace std;

class Resistor{

private:

double tolerance, nominal;

double minResistance, maxResistance;

public:

Resistor(double , double );

~Resistor(){}

double getMinResistance();

double getMaxResistance();

double getTolerance();

double getnominal();

};

#endif

Capacitor.cpp:

#include "Capacitor.h"

Capacitor::Capacitor(double N, double T){

}

double Capacitor::getMinCapacitance(){

}

double Capacitor::getMaxCapacitance(){

}

double Capacitor::getTolerance(){

}

double Capacitor::getnominal(){

}

Filter.cpp:

#include "Filter.h"

Filter::Filter(string Ftype, Resistor Ris, Capacitor Cap){

}

double Filter::getMinFreq(){

}

double Filter::getMaxFreq(){

}

string Filter::getFilterType(){

}

Resistor.cpp:

#include "Resistor.h"

Resistor::Resistor(double N, double T){

}

double Resistor::getMinResistance(){

}

double Resistor::getMaxResistance(){

}

double Resistor::getTolerance(){

}

double Resistor::getnominal(){

}

Source.cpp:

#include "Filter.h"

void main(){

system("pause");

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions