Essay COMP 220 Week 2 Lab Classes Objects and Encapsulation

Essay COMP 220 Week 2 Lab Classes Objects and Encapsulation

 Essay COMP 220 Week 2 Lab Classes Objects and Encapsulation
Essay COMP 220 Week 2 Lab Classes Objects and Encapsulation

COMP 220 Week 2 Lab Classes Objects and Encapsulation

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.
Include your name and the exercise number.

iLAB STEPS
STEP 1: Create a Multifile Project
Objective: Create a C++ console application that will model the characteristics of a resistor.

  1. Create a multifile project. Create and add to the project an h file containing the resistor-class definition.
  2. Create and add to the project a cpp file containing the implementation of the class-member functions.
  3. Create and add to the project a ccp file containing the main() function, which will instantiate a resistor object and test its member functions.

STEP 2: Required Class Members
The resistor class will, at minimum, have members that do the following.

  1. store the nominal resistance value of a resistor
  2. store the tolerance of a resistor
  3. initialize any and all nominal-resistance values to correct, EIA, nonzero values that are greater than 0 and less than 1,000,000 ohms
  4. initialize any and all resistance-tolerance values to correct, E12, E24, E48, or E96 resistance-tolerance values
  5. allow the nominal-resistance and tolerance values of a resistor object to be changed by the user
  6. All member functions should have a test message stating the name of the function. All the test messages should be displayed or not displayed, depending on the value of a Boolean variable declared in main().
    • If the Boolean value = true, display the message.
    • If the Boolean value = false, do not display the message.

STEP 3: Program Operations

  1. Function main() should instatiate two objects of class resistor.
  2. Function main() should display the current values of all resistor objects.
    Function main() should also calculate and display the minimum and maximum in-tolerance resistance values of each resistor object from the resistor data members.
  3. Function main() should allow the user to change the values of the nominal resistance and the resistor tolerance of both resistor objects, and it should also correctly handle out of numeric-range input. Main() is also responsible for making sure that the user can successfully enter only correct, EIA resistance and tolerance values.
    The user should be given the following data-entry choices:
    accept current EIA values for resistance and tolerance;
  4. The function main() should display the new, modified values of the resistor object, including the new min and max in-tolerance resistance values.
  5. The function main() should be executed twice: once with the test messages displayed and once without.

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.
  2. How was this reference discovered and where?
  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.
  4. In the lab, you were required to provide mutator functions to change the nominal-resistance and tolerance values of a resistor object.
    Describe how this was accomplished so that the user could not enter an invalid nominal-resistance and E-series tolerance combination.
  5. Describe how this process was different and/or similar to how you implemented this validation in the class constructor.

Get Fast Writing Help – No Plagiarism Guarantee!

Fastwritingservice.com is one of the best Online assignment writing websites that provide students with quality academic term papers, admission essays, annotated bibliographies, reports, essays, personal statements, research proposals, research papers, projects, presentations, movie and book reviews, application papers, among others.

Top-Rated Essay Writing Service | Flawless papers for All Your classes!

PLACE YOUR ORDER