Comp 220 ilab 4 of 7


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Comp 220 ilab 4 of 7

  1. 1. COMP/220 iLab 4 of 7 - C++ CourseiLAB OVERVIEWScenario and SummaryThis 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 theuser 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 capacitorobject. You are then to define and implement a filter class that will contain one object of each theresistor 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 theresistor 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 cppand h files for each class defined. In addition, the program will have the capacity to save all filterparameters to a text file and read previously designed filter parameters from a text file.Deliverables1. Submit a single Notepad file containing the source code for all the files of the lab to theDropbox for Week 4. Your source code should use proper indentation and be error free. Be sure thatyour last name and the lab number are part of the file name: for example, YourLastName_Lab4.txt.Each program should include a comment section that includes, at a minimum, your name, the laband exercise number, and a description of what the program accomplishes.2. Submit a lab report (a Word document) containing the following information to theDropbox for Week 4.o Include your name and the lab or lab-exercise number.o Specification: Include a brief description of what the program accomplishes, including itsinput, key processes, and output.o Test Plan: Include a brief description of the method you used to confirm that yourprogram worked properly. If necessary, include a clearly labeled table with test cases, predictedresults, and actual results.
  2. 2. o Summary and Conclusions: Write a statement summarizing your predicted and actualoutput, and identify and explain any differences. For conclusions, write at least one nontrivialparagraph that explains, in detail, either a significant problem you had and how you solved it or, ifyou had no significant problems, something you learned by doing the exercise.o A UML diagram: This should show all classes, class members, access specifiers, datatypes, and function arguments, along with the composition relationship of the classes.o Answers to Lab Questions: The answers to any and all lab questions are included in thelab steps.Each lab exercise should have a separate section in the lab-report document.Your lab grade will be based upon1. the formatting of your source code;2. the use of meaningful identifiers;3. the extent of internal documentation;4. the degree to which an exercises’ specifications are met; and5. the completeness of your lab report.iLAB STEPSSTEP 1: Create a Multifile Project for the Composition Lab1. 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 DefinitionThe Filter class should have, at a minimum, the following capabilities.1. a resistor-object data member2. a capacitor-object data member3. a cutoff frequency (in Hertz) of the RC filter4. maximum and minimum cutoff frequencies, based on the maximum and minimum in-tolerance values of the capacitor and the resistor object5. a filter type, either low pass or high pass6. allow the user to enter new values for the filter, including6.1. resistor tolerance and nominal resistance;
  3. 3. 6.2. capacitor tolerance and nominal capacitance; and6.3. filter type7. provides the ability to write all capacitor, resistor, and filter data members to a formattedtext file and allows the user to name the file8. provides the ability to read all capacitor, resistor, and filter data members from aformatted text file and allows the user to enter the file name and correctly handles a file-not-founderrorSTEP 3: Test-Program Operation1. All data-input and data-display operations (cin and cout) should be done in the functionmain() 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, andCapacitor classes.b. The Filter class should then calculate and display the correct maximum and minimumcutoff frequencies.3. The test program should then display all Filter, Resistor, and Capacitor data members.CLICK HERE TO GET THE SOLUTION !!!!!!!!!