Composition using Visual Studio and C++

Sep 28th, 2013
DotaCN
Category:
Programming
Price: $30 USD

Question description

This Needs to becompleted using Visual Studio Only! It can be downloaded for free here: http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express

STEP 1: Create a Multifile Project for the Composition Lab
1. Add three classes to the project: a Filter class, a Capacitor class, and a Resistor class.
2. You may use the Resistor class files from the Week 2 lab for this lab. 
3. The Capacitor class should be modeled after the Resistor class for class members and operation. 

STEP 2: Filter-Class Definition

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

  1. 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
  2. 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

STEP 3: Test-Program Operation

  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.
    1. The user should enter values for all the data members of the Filter, Resistor, and Capacitor classes.
    2. 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.

Example Code: ( This example code is for all the file in the project it will be split over 7 diffent filess)

#include <iostream>

#include <string>

using namespace std;

class CResistor{

private:

double nominalValue;

double tolerance;

double minimumValue;

double maximumValue;

public:

CResistor() {

nominalValue = 100;

tolerance    = 10;

computeResistorLimits();

}

void computeResistorLimits() {

minimumValue = nominalValue*(1-tolerance/100);

maximumValue = nominalValue*(1+tolerance/100);

}

void enterResistor() {

cout<<"Please enter value of resistance"<<endl;

cin>>nominalValue;

cout<<"Please enter tolerance of resistor (i.e. 10 for 10% tolerance)"<<endl;

cin>>tolerance;

computeResistorLimits();

}

void displayResistor() {

cout<<minimumValue<<" Ohms <= R <= "<<maximumValue<<" Ohms"<<endl;

}

double getResistance(){

return nominalValue;

}

};

class CCapacitor{

private:

double nominalValue;

double tolerance;

double minimumValue;

double maximumValue;

public:

CCapacitor() {

nominalValue = 100;

tolerance    = 10;

computeCapacitorLimits();

}

void computeCapacitorLimits() {

minimumValue = nominalValue*(1-tolerance/100);

maximumValue = nominalValue*(1+tolerance/100);

}

void enterCapacitor() {

cout<<"Please enter value of capacitance"<<endl;

cin>>nominalValue;

cout<<"Please enter tolerance of capacitor (i.e. 10 for 10% tolerance)"<<endl;

cin>>tolerance;

computeCapacitorLimits();

}

void displayCapacitor() {

cout<<minimumValue<<" microFarads <= C <= "<<maximumValue<<" microFarads"<<endl;

}

double getCapacitance() {

return nominalValue;

}

};

class CRCFilter {

private:

CResistor  R;

CCapacitor C;

double cutoffFrequency;

public:

CRCFilter() {

cutoffFrequency = 1/(2*3.1415*R.getResistance()*C.getCapacitance()*.000001);

}

void displayFilterParameters(){

cout<<"The filter has:"<<endl;

cout<<"R  = "<< R.getResistance() <<" Ohms"<<endl;

cout<<"C  = "<< C.getCapacitance()<<" MicroFarads"<<endl;

cout<<"Fc = "<<cutoffFrequency<<" Hz"<<endl;

}

};

void main() {

CRCFilter F1;

F1.displayFilterParameters();

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
kevin12622
Dec 7th, 2016
" Goes above and beyond expectations ! "
kiln82
Nov 28th, 2016
" awesome work thanks "
ashleyisgod
Nov 23rd, 2016
" Top quality work from this guy! I'll be back! "
likeplum4
Nov 14th, 2016
" Excellent work as usual "
Molly_Moon
Nov 1st, 2016
" AMAZING as always! "
kpcutie
Oct 23rd, 2016
" Excellent job "
Hemapathy
Oct 9th, 2016
" all I can say is wow very fast work, great work thanks "
pmallory
Sep 30th, 2016
" Totally impressed with results!! :-) "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors