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

C++ need the .cpp files and the .h files The .txt files also. Thank you Add thre

ID: 670376 • Letter: C

Question

C++ need the .cpp files and the .h files

The .txt files also.

Thank you

Add three classes to the project: a Filter class, a Capacitor class, and a Resistor class.

You may use the Resistor class files from the Week 2 lab for this lab.

The Capacitor class should be modeled after the Resistor class for class members and operation.

Resistor.cpp and .h

#include<iostream>

#include<string>

#include<iomanip>

#include<cstdlib>

#include"Resistor.h"

using namespace std;


                                   //DEFAULT CONSTRUCTOR

CResistor::CResistor()

{
  

   resValue = 0;

   resTolerance = 0;

}

                                   // CONSTRUCTOR

CResistor::CResistor(double resValue1, double resTolerance1, string name1, bool fndisplay)

{

   if (fndisplay)

       cout << " CONSTRUCTOR";

   name = name1;

   resValue = resValue1;

   resTolerance = resTolerance1;

}

CResistor::~CResistor()
{
}

                                                   //   NAME OF THE RESISTOR

void CResistor::setName(string name, bool fndisplay)

{

   if (fndisplay)

       cout << " now setName" << endl << endl;

   this->name = name;

}

                                                   //GET RESISTOR NAME

string CResistor::getName(bool fndisplay)

{

   if (fndisplay)

       cout << " now getName" << endl << endl;

   return name;

}

                                                   ////SET RESISTANCE

void CResistor::setNominal(double nominal, bool fndisplay)

{

   if (fndisplay)

       cout << " now setNominal" << endl << endl;

   resValue = nominal;

}

                                                   ////GET RESISTANCE

double CResistor::getNominal(bool fndisplay)

{

   if (fndisplay)

       cout << " now getNominal" << endl << endl;

   return resValue;

}

                                                   ///////SET TOLERANCE

void CResistor::setTolerance(double tol, bool fndisplay)

{

   if (fndisplay)

       cout << " now setTolerance" << endl << endl;

   resTolerance = tol;

}

                                                   ////////GET TOLERANCE

double CResistor::getTolerance(bool display)

{

   if (display)

       cout << " now getTolerance" << endl << endl;

   return resTolerance;

}

and the .h/////////////////////////////////////////////////////////////////////////////////////////////


#include <iostream>

#include <string>

#include <iomanip>

#include <cstdlib>

using namespace std;


#ifndef RESISTOR_H

#define RESISTOR_H

//class CResistor

class CResistor

{

                                                       // name, value, tolerance

private:

   string name;

   double resValue;

   double resTolerance;

public:

                                                       // set the value
   //CResistor(double resNom, double resTol, string resName, bool fnDisplay);
   void setName(string, bool);

   string getName(bool);

   double getNominal(bool);

   void setNominal(double, bool);

   double getTolerance(bool);

   void setTolerance(double, bool);

   CResistor();

   CResistor(double resvalue, double resTolerance, string name, bool fndisplay);

   ~CResistor();
};

#endif

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

NEXT

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 RC filter

maximum and minimum cutoff frequencies, 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

6.1. resistor tolerance and nominal resistance;
6.2. capacitor tolerance and nominal capacitance; and
6.3. filter type

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

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

MUST USE FOR MAIN


///You are required to use this int main() DRIVER / TEST FILE.


#include "Capacitor.h"

#include <conio.h>

#include "Filter.h"

#include <iostream>

#include "Resistor.h"

#include <windows.h>

#include <iomanip>

using namespace std;

void clear_screen(void);

void main(void)

{

   // Local variable for text data entry

   char tempName[16];


   // Local variable for component value data entry

   double tempValue;

   cout << "Instantiate one object of class Filter" << endl << endl;

   cout << "Enter a name for the new filter object: ";

   cin.getline(tempName, 15, ' ');

   Filter filt1;

   // Display filter values

   cout << setiosflags(ios::fixed) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;

   cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;

   cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;

   cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl;

   // Display resistor values

   cout << setiosflags(ios::fixed) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;

   cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;

   cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;

   cout << endl << endl;

   // Display capacitor values

   cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setiosflags(ios::left) << setprecision(3);

   cout << "Nominal Capacitance Value = " << setw(10) << filt1.getCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Capacitor Tolerance Value = " << setw(10) << filt1.getCapTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Capacitance Value = " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Minimum Capacitance Value = " << setw(10) << filt1.getMinCapacitance() * 1000000 << " micro Farads" << endl;

   cout << endl << endl;

   //filt1.FilterSave();

   cout << "Enter new nominal resistance value for filter: ";

   cin >> tempValue;

   filt1.setResistance(tempValue);

   xout << "Enter new resistance tolerance value for filter: ";

   cin >> tempValue;

   filt1.setResTolerance(tempValue / 100.0);

   cout << "Enter new nominal micro Farad capacitance value for filter: ";

   cin >> tempValue;

   filt1.setCapacitance(tempValue / 1000000.0);

   cout << "Enter new capacitance tolerance value for filter: ";

   cin >> tempValue;

   filt1.setCapTolerance(tempValue / 100.0);   /// This line of code was fixed

                                               // Calculate filter values based on new resistance and capacitance values

   filt1.calculateFilter();

   // Display filter values

   cout << setiosflags(ios::fixed) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;

   cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;

   cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;

   cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl;

   // Display resistor values

   cout << setiosflags(ios::fixed) << resetiosflags(ios::left) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;

   cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;

   cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;

   cout << endl << endl;

   cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setiosflags(ios::left) << setprecision(3);

   cout << "Nominal Capacitance Value = " << setw(10) << filt1.getCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Capacitor Tolerance Value = " << setw(10) << filt1.getCapTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Capacitance Value = " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Minimum Capacitance Value = " << setw(10) << filt1.getMinCapacitance() * 1000000 << " micro Farads" << endl;

   cout << endl << endl;

   filt1.FilterRead();

   //filt1.calculateFilter( // Display filter values

   cout << setiosflags(ios::fixed) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;

   cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;

   cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;

   cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl;

   // Display resistor values

   cout << setiosflags(ios::fixed) << resetiosflags(ios::left) << setiosflags(ios::right) << setiosflags(ios::showpoint) << setprecision(3);

   cout << endl << endl;

   cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;

   cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;

   cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;

   cout << endl << endl;

   cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setiosflags(ios::left) << setprecision(3);

   cout << "Nominal Capacitance Value = " << setw(10) << filt1.getCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Capacitor Tolerance Value = " << setw(10) << filt1.getCapTolerance() * 100 << " Percent" << endl;

   cout << "Maximum Capacitance Value = " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;

   cout << "Minimum Capacitance Value = " << setw(10) << filt1.getMinCapacitance() * 1000000 << " micro Farads" << endl;

   cout << endl << endl;

}

NEED 9 FILES

Capacitor.cpp and .h

Fliter.cpp and .h

Filtermain.cpp "that i added"

Risistor.cpp and .h ""that i added"

/////////////////////////////////////////////////////////////////////////////////

And LAst

the test.

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.

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

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

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

Explanation / Answer

public class Filter{
   private:
       Resistor resistor;
       CResistor capacitor;
       double cutOffFrequency;
       double maxcutofffrequency;
       double mincutofffrequency;
       string filterType;
       string fileName;
  
   //Conditions on how to calculate these filters so that I cannot write
   public:
       void FilterSave(){
          
           //save file based on fileName and data needed
       }
  
      

}

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