The menu must reject bad input data and force the user to

Assignment Help Electrical Engineering
Reference no: EM13346126

Objective: Practice inheritance and using pointers. Create a program that tests the members of the Resistor Class and Fancy Resistor Class to ensure that they work properly.
Create a derived class named FancyResistorClass by inheriting the ResistorClass.
Begin work on this class by first coding the class declaration. Then code and test the class constructor function. Code and test the rest of the functions one function at a time. To avoid compiler complaints, comment out the member function prototype declarations that have not yet been completed.
The Fancy Resistor Class should include the following members:
Protected Member Variable Specification
char *m_sptrResType A protected member that is a pointer to a character array. This pointer will hold the address of a dynamic character array that contains the resistor's type - Carbon Film, Metal Film, Carbon or Power.

Public Member Functions Specification
FancyResistorClass( char Name [], double nominalResistance, double Tolerance) This is the parameterized constructor, which will accept arguments for the resistor's name, nominal resistance and tolerance.
You will need to use the new operator to allocate memory for a character array variable that will be pointed to by m_sptrResType.
The user will be displayed an menu of resistor types and be prompted to select a type. The menu options will be:
1. Carbon Film
2. Metal Film
3. Carbon
4. Power

The menu must reject bad input data and force the user to enter a correct resistor type selection.
The user's valid selection will then be stored in the resistor type character array as either Carbon Film, Metal Film, Carbon or Power.
Be sure to include an output statement that displays the message "FancyResistorClass Constructor Called"

void DisplayResistor (void) This function will override the the base class function of the same name.
This function will output the resistor's type and call the base class display resistor function.

~FancyResistorClass( ) This is the Fancy Resistor Class destructor function.
This function should prevent memory leaks by deallocating any previously allocated memory.

Be sure to display the message "FancyResistorClass Destructor Called"
Test the base and derived resistor classes by completing the following tasks:

The main() function should instantiate two objects of ResistorClass: oResOne, oResTwo. oResOne should be instantiated using the default constructor and oResTwo should use the parameterized constructor. In using the parameterized constructor simply pass the three required arguments to test if the constructor works correctly.
Create a third resistor that is a FancyResistorClass object. Use the FancyResistorClass parameterized constructor to instantiate this object.
Display the values of each of the resistor objects.
End the program

Reference no: EM13346126

Questions Cloud

A solution is prepared by mixing 1300ml of 00021m aqueous : a solution is prepared by mixing 13.00ml of 0.0021m aqueous hg2no32 with 25.00ml of 0.015m hcl.a. will precipitation
Bif 550 grams of silver are produced in the above reaction : for this reaction answer the following questions cu 2 agno3 -gtcuno32 2 aga.how many grams of copper are required to
Determine the percent yield for the reaction between 374g : determine the percent yield for the reaction between 3.74g of na and excess o2 if 5.35g of na2o2 is
Te acceleration due to gravity at sea level is g 981 ms2 : the acceleration due to gravity at sea level is g 9.81 ms2 . what is the persons weight at sea level? the acceleration
The menu must reject bad input data and force the user to : objective practice inheritance and using pointers. create a program that tests the members of the resistor class and
Calculate the incidence it of the tailplane for trim if the : calculate the incidence it of the tailplane for trim if the elevator deflection e is zero. ii calculate the neutral
How many grams of zinc metal will react with 245 ml of 20 m : how many grams of zinc metal will react with 24.5 ml of 2.0 m hydrochloric acid hcl forming zinc chloride zncl2?
Jacob couldnt find the 6 m h2so4 so instead substituted the : jacob couldnt find the 6 m h2so4 so instead substituted the 6 m hno3 that was available. what change was most likely
How many moles of leadiinitrate pbno32will be needed to : how many moles of leadiinitrate pbno32will be needed to react with sodium chromate na2cro4 to produce 4.62 kg of

Reviews

Write a Review

Electrical Engineering Questions & Answers

  Lithium ion battery technology

The paper includes Lithium ion battery technology with its advantages and disadvantages. The paper discusses about the Lithium air battery in which detailed reactions of Lithium with air including nonaqueous as well as aqueous are given.

  Power transformers and tariffs

Construction of different types of power transformer, significant energy savings

  Paper on orthogonal frequency-division multiplexing

This document is shown a paper on Orthogonal frequency-division multiplexing with advantages, disadvantages and uses.

  Function of the hmi in a scada system

This assignment contains electronics engineering questions like State the commonly found components of a SCADA (Supervisory control and data acquisition) system. and decribe the function of the HMI in a SCADA system.

  Resultant waveform of the odd harmonic series

Prepare an Excel graph showing the individual components and summated resultant waveform of the odd harmonic series resulting in an approximate square wave.

  Explain scada system

Explain the function of the HMI in a SCADA system.

  Design a 2-digit 24 second shot-clock

Design a 2-digit 24 second "shot-clock" countdown timer with pushbutton controller.

  Model a discrete-time system

To understand di erent signal models To be able to model a discrete-time system and design simple signal processing algorithms.

  Draw a relay construction diagram

Draw a relay construction diagram and briefly explain the operation of a relay.

  Frequency division multiplexing

Write a short technical report on Frequency Division Multiplexing

  Impact of electron energy

Briefly discuss the impact of electron energy, electron current and target on the Bremsstrahlung generated.

  Traffic light controller

The schematic of the traffic light controller

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd