must work in C++ with visual studios 2008

must work in C++ with visual studios 2008:Objective: Create a C++ console application that utilizes the core concepts of inheritance and pointers by creating a class and a program that tests important features of that class.Overview: This lab will require you to use C++ class inheritance to define and use a resistor class derived from a base resistor class. The program will allow the user to specify resistor component types and values.You will be required to define a base class (ResistorClass) for a generic resistor device and a derived classes (FancyResistorClass) for specific resistor device type.Resistor Class UML Diagram (# indicates a protected member):Class: ResistorClass# double *m_dptrRes# char *m_sptrResName+ int m_istResCounter (static)+ void DisplayResistor(void)+ void EnterResistance (void)+ ResistorClass( )+ ResistorClass(char Name[], double nominalResistance, double Tolerance)+ ~ResistorClass( )Begin work on this program by first coding the Resistor Class class declaration. Then code and test the Resistor class constructor functions one at a time. Code and test the rest of the functions one function at a time. To avoid compiler complaints, comment out the member function prototypes in the Resistor Class declaration that have not yet been completed.specifications:This is the default constructor.* You will need to create two dynamic arrays using the new operator. The first array will store the resistor values (nominal, tolerance, min and max) and the second array (a character array) will hold the resistor’s name.* The resistor array will have four elements. The values stored in the array will be of data type double. The values will be stored to the array in the following positions:m_dptrRes[0] = the nominal resistance valuem_dptrRes[1] = the tolerance valuem_dptrRes[2] = the max resistance valuem_dptrRes[3] = the min resistance valueThe nominal value should be initialized to 1000.0 and the tolerance value should be initialized to .10.The minimum and maximum resistance should then be calculated using the nominal and tolerance variables. The formulas are:Minimum Resistance = Nominal – Nominal * ToleranceMax Resistance = Nominal + Nominal * Tolerance* The user should be prompted to supply a name for the resistor. The value supplied by the user will be stored using the resistor’s name pointer. To conserve memory the name array should allocate only enough room to hold the number of characters supplied by the user. You’ll want the user’s entry to be saved to a string variable using the getline function. Then you’ll need to determine the number of characters in the string variable, allocate the required memory and copy the characters from the string variable to the pointer. This requirement is more for demonstration purposes than it is for practicality. Here is the essential code://get the user’s inputstring Name;getline(cin, Name);//get the number of characters in the stringint length = (int)Name.length();//add one to account for the null characterm_sptrResName = new char[length + 1];//copy from Name to the pointerstrcpy_s(m_sptrResName, length + 1, Name.c_str());The strcpy_s function performs a deep-copy of character array data. You could replace the strcpy_s function with a for/loop that performs a deep copy. The syntax for strcpy_s is as follows:strcpy_s(char *Destination,int numberOfElements,char *Source);* To keep count of the number of resistor objects in existence, be sure to increment the static variable m_istResCounter.* Be sure to include an output statement that displays the message “Default Constructor Called”

 

CLICK HERE TO ORDER A SIMILAR PAPER

We pride ourselves in writing quality essays

CLICK HERE TO CONTACT US

Lets Start Working

Plagiarism Free

We use anti-plagiarism software to ensure you get high-quality, unique papers. Besides, our writers have a zero plagiarism mentality

On Time Delivery

Your essay will be delivered strictly within the deadline.  If you have an urgent order, we can do it!

Money Back Guarantee

We offer warranty service, including free revisions, and a right to request a refund incase your expectations are not met!

THE BEST PAPER WRITER HELPER

Our Advantage

  • Say “NO” to plagiarism – FREE plagiarism report as an addition to your paper
  • The lowest prices that fit excellent quality
  • Authorship – you are the one who possesses the paper. We DO NOT re-sale or re-use any of them.

OUR PAPER WRITER HELPER GOODIES

Our Freebies

  • Free Cover Page
  • Free Revisions
  • Free Reference Page
  • Free 24/7 support

Pin It on Pinterest

Share This