Вы находитесь на странице: 1из 3

Liem Nguyen COMP 122 ILAB #2 11/7/2011

Scenario and Summary This lab requires you to create a multifile C++ project in order to design and implement an object-oriented program using a class to model the characteristics and function of a resistor. Deliverables


Submit a single Notepad file containing the source code for Exercise 1 to the Dropbox for Week 2. Your source code should use proper indentation and be error free. Be sure that your last name and the lab number are part of the file name; see the following example: YourLastName_Lab1.txt. Each program should include a comment section that includes (at a minimum) your name, the lab and exercise number, and a description of what the program accomplishes. Submit a lab report (a Word document) containing the following information to the Dropbox for Week 2. o o o o o Include your name and the exercise number. Specification: Include a brief description of what the program accomplishes, including its input, key processes, and output. Test Plan: Include a brief description of the method you used to confirm that your program worked properly. If necessary, include a clearly labeled table with test cases, predicted results, and actual results. Summary and Conclusions: Include a summary of what the lab demonstrated and any conclusions drawn from the testing of the lab program. Answers to Lab Questions: Answer any and all lab questions included in the lab steps.


Summary: Write a statement summarizing your predicted and actual output. Identify and explain any differences. Conclusions: Write at least one nontrivial paragraph that explains, in detail, either a significant problem you had and how you solved it or, if you had no significant problems, something you learned by doing the exercise. Each lab exercise should have a separate section in the lab-report document. Your lab grade will be based upon 1. 2. 3. 4. 5. the formatting of your source code; the use of meaningful identifiers; the extent of internal documentation; the degree to which an exercises specifications are met; and the completeness of your lab report. I. Specification - Design and implement an object-oriented program using a class to model the characteristics and function of a resistor. Test Plan - Input the values of the resistor: + 1st Resistor value: 100, 1, 20


Liem Nguyen COMP 122 ILAB #2 11/7/2011

Predict Output: 1. +
Resistor object name is E12 Nominal resistance value : 100 Tolerance = 10% Minimum Resistance = 90 Maximum Resistance = 110

+ Current resistance tolerance = 100 Ohm

Valid tolerances are 1%, 2%, 5% or 10%


Summary and Conclusions - I havent completed the program and get the right result, so I cant give the conclusion

STEP 4: Lab Questions You are not required to copy the question text into your document, but all answers should be listed with the question number they answer.

1. List the complete reference-source information for where you found the EIA standard resistor value and
tolerance information.

http://www.logwell.com/tech/components/resistor_values.html 2. How was this reference discovered and where? Google search. 3. The constructor requires the initialization values for the nominal resistance and the tolerance when an
object is instantiated to be a correct E-series resistance and tolerance combination. Describe how this was accomplished in your program design and implementation.

The initial value of 3 resistors is: Res1 has value 4700.0 Ohm, and 10% tolerance. Res2 has value 330.0 Ohm, and 10% tolerance. Res3has value 10000.0 Ohm, and 10% tolerance. 4. In the lab, you were required to provide mutator functions to change the nominal-resistance and tolerance
values of a resistor object. a. Describe how this was accomplished so that the user could not enter an invalid nominal-resistance and E-series tolerance combination.

Liem Nguyen COMP 122 ILAB #2 11/7/2011

After you input the resistance and tolerance value of the resistor, there will be a function to check the condition. First, the resistance value must be between 1 and 1,000,000 Ohms Second, the tolerant value must be entered 1, 2, 5 or 10 corresponding with 1%, 2%,
5% and 10%.

5. Describe how this process was different and/or similar to how you implemented this validation in the class