Ask C/C++ Expert


Home >> C/C++

This must work in C++ visual studios 2008 with the latest libraries.

Objective: Create a C++ console application that utilizes the core concepts of designing and creating classes, objects, properties and methods. 

Overview: Add two constructor functions and a destructor function to the Resistor class from last week's lab assignment.

Resistor Class UML Diagram (new members are in bold font): 

Class: ResistorClass 
+ string m_cResistorName;
- double m_dResValue;
- double m_dTolerance;
- double m_dMinResistance;
- double m_dMaxResistance; 
+ void DisplayResistor(void)
+ void EnterResistance (void )
+ void AddSeries (ResistorClass Resistor1, ResistorClass Resistor1)

+ ResistorClass( )
+ ResistorClass(string Name, double nominalResistance, double Tolerance)
+ResistorClass(const ResistorClass &ResistorObject)
+ ~ResistorClass( ) 

Resistor Class Member Specifications:

Member Variables Specification 
string m_cResistorName Stores the resistors name 
double m_dResValue Stores the resistor's nominal value 
double m_dTolerance The resistor's ohm tolerance stored as a decimal value 
double m_dMinResistance The resistor's minimum resistance in ohms 
double m_dMaxResistance The resistor's maximum resistance in ohms 



New Member Functions Specification 
ResistorClass( ) Prompt the user to input a name for the resistor object. Store the name in the member variable m_cResistorName.

Initialize the resistor data members to the following values:

Set m_dResValue = 1000.0
Set m_dTolerance = 0.10

The value of m_dMinResistance and m_dMaxResistance should be calculated using the member variables m_dResValue and m_dTolerance. Use the formula from week 3's lab assignment.

This function should output the message: "Default Constructor Called" 
ResistorClass(string Name, double nominalResistance, double Tolerance) This is a parameterized constructor that accepts arguments for the resistor's name, nominal resistance and tolerance.

The parameters nominalResistance and Tolerance will be used to initialize the member variables m_dResValue and m_dTolerance. 
The value of m_dMinResistance and m_dMaxResistance should be calculated using the member variables m_dResValue and m_dTolerance. Use the formula from week 3's lab assignment.

This function should output the message: "Parameterized Constructor Called" 

ResistorClass(const ResistorClass &ResistorObject) This is a copy constructor used to copy the values of an already existing Resistor object.

The nominal, tolerance, minimum and maximum values should be copied from the resistor object passed to the function as an argument. 
This function will prompt the user to enter a new name for the Resistor object receiving the copied values. The name will be stored in the member variable m_cResistorName.

This function should output the message: "Copy Constructor Called" 

~ResistorClass( ) This is the destructor function. This function will output the message "Destructor Called for " and complete the message by displaying the resistor's name as stored in the member variable m_cResistorName. 

Note: Begin work on this program by first creating the class declaration. Then code and test the default and then the parameterized constructor functions. Code and test the rest of the functions one at a time. To avoid compiler complaints, comment out the member function prototypes in the class declaration that have not yet been completed.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M9641373

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As