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

This lab requires you to use C++ class composition to implement a single pole-fi

ID: 3647455 • Letter: T

Question

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.

Composition may be thought of as a has-a relationship for objects, as compared to inheritance, which may be described as an is-a relationship for objects.

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 Resistor class created in the Week 2 iLab may be used both as the class definition for the resistor object and as a template or a guide for the capacitor-class definition.

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. In addition, the program will have the capacity to save all filter parameters to a text file and read previously designed filter parameters from a text file.

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"); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote