Question: Please let me know how to write C++ code. Have to use the variables or functions that are mention in the instruction. (Please do not

Please let me know how to write C++ code.

Have to use the variables or functions that are mention in the instruction. (Please do not use these: ignore, numeric_limits, clear, break)

Need 2 separate files - NameTag.cpp NameTag.h

Please let me know how to write C++ code. Have to usethe variables or functions that are mention in the instruction. (Please donot use these: ignore, numeric_limits, clear, break) Need 2 separate files -Tester Program main.cpp

NameTag.cpp NameTag.h Tester Program main.cpp Correct Output Please note that you can

Correct Output

(and probably should) add more member functions to make the DIY part

Please note that you can (and probably should) add more member functions to make the DIY part work. Create a Module for a NameTag to create/read information for a name tag and print it. The class name must be NameTag. It should be able to hold two pieces of information; A name and a 5 digit extension number. The name should be kept dynamically; however if the name is longer than 40 characters, only 40 characters should be printed in the name tag. Also if the name is shorter than 20 characters, it should be printed in 20 spaces. The extension number is optional and if not provided, it should be printed as N/A. Print the name tag by drawing a box around it. The box must have five interior lines and the name should have exactly one space distance with the line of the box at left and minimum of one space with the line at right. The name and the extension are printed on lines 2 and 4 and the rest of the name tag is filled with spaces. Here are couple of examples: (Name: "Fred Soley", extension 12345): (Name: "David Wright Mason Gilmour Waters Rogers Nick", extension not available) constructors - default constructor (for an empty tag) - constructor with one argument to set the name without extension number - constructor with two arguments to set the name and the extension destructor - have a destructor to avoid memory leaks Functions: print a function called print to print the name tag as shown above read A function called read that receives the name and then the extension number from console and returns the reference of the current object (NameTag\&). Read function should read the name up to the maximum of 40 characters and ignore the rest and then set the name of the NameTag to the entered name. (This may overwrite an already existing name in the NameTag) Then it should give an option to the user to enter the extension number or not. If the user chooses to enter the extension it should enforce the user to enter a 5 digit integer and if user does not comply, it should print one of the following messages based on the type of the error: and get the new value and repeat until the user enters a correct value. A sample for execution is provided below; Note that the read() execution is demonstrated right before the name tag printouts.(The exact tester output is in Execution Sample Section) Please enter the name: Hubert Blaine Wolfeschlegelsteinhausenbergerdorff Would you like to enter an extension? (Y)es/(N)o: x Only (Y) or (N) are acceptable, try agin: n Please enter the name: Lisa Simpson Would you like to enter an extension? (Y)es/(N)o: Y Please enter a 5 digit phone extension: five Bad integer value, try again: 9999 Invalid value [10000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!