Project requirement: The Filter class should have, at a minimum, the following c
ID: 3628760 • Letter: P
Question
Project requirement:The Filter class should have, at a minimum, the following capabilities.
1. a resistor-object data member
2. a capacitor-object data member
3. a cutoff frequency (in Hertz) of the RC filter
4. maximum and minimum cutoff frequencies, based on the maximum and minimum in-tolerance values of the capacitor and the resistor object
5. a filter type, either low pass or high pass
6. allow the user to enter new values for the filter, including
6.1. resistor tolerance and nominal resistance;
6.2. capacitor tolerance and nominal capacitance; and
6.3. filter type
7. provides the ability to write all capacitor, resistor, and filter data members to a formatted text file and allows the user to name the file
8. provides the ability to read all capacitor, resistor, and filter data members from a formatted text file and allows the user to enter the file name and correctly handles a file-not-found error
Program specifics:
1. All data-input and data-display operations (cin and cout) should be done in the function main() test program.
2. 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
Thanks in advance for the much appreciated help!
Explanation / Answer
#pragma once; #include #include #include #include #include #include using namespace std; const double PI=3.1415927; class CResistor { protected: double res_kohms; public: void setResistance(); double getResistance(); }; class CCapacitor { protected: double cap_uF; public: void setCapacitance(); double getCapacitance(); }; class RCFilter { protected: CResistor resistor; CCapacitor capacitor; char filterType; double frequency; public: void setResistance(); void setCapacitance(); void setFilterType(); double getFrequency(); void showFrequency(); void showfilterDesign(); }; COORD getXY(); void gotoXY(int nX, int nY); // RCFilter.cpp #include "RCFilter.h" void CResistor::setResistance() { } double CResistor::getResistance() { return 1.0; } void CCapacitor::setCapacitance() { } double CCapacitor::getCapacitance() { return 1.0; } void RCFilter::setResistance() { } void RCFilter::setCapacitance() { } void RCFilter::setFilterType() { } double RCFilter::getFrequency() { return 1.0; } void RCFilter::showFrequency() { } void RCFilter::showfilterDesign() { if (filterType=='L') { } else { } cout dwCursorPosition.Y; delete pBuffer; return Coordinates; } // RCFilter-Main.cpp // #include "RCFilter.h" void main() { RCFilter rcf; char ch; do { system("CLS"); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.