Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve in C++ please 20.29 Programming Project #1: Number Printer Programming Project 1 This is a more comprehensive programming project. You should should have formal
Solve in C++ please
20.29 Programming Project #1: Number Printer Programming Project 1 This is a more comprehensive programming project. You should should have formal code that is properly CONTWTIented and include headers. Your comments will be evaluated after your code is submitted. The following multipliers will be applied Proper Comments: 100% Minimal Comments 80% No Comments 50% Task: You are to design and build a number-printer class hierarchy. There is one virtual parent class and three concrete subclasses. The parent class should be called Number Printer. The three subclasses are called SmallPrinter, MediumPrinter, and Large Printer. Each class takes in three one-digit numbers 109] and prints it out in various formats. If the three numbers were 1, 2 and 3, then Small Printer would print 1 2 3 Medium Printer would print: 1 1 1 Each digit is four spaces wide and seven tall with one space between numbers - it is hard to see the spaces with the 'T' digit. Think of it as ani LCD display with two dashes per element. Large Printer would print Each digit is five spaces wide and nine tall with one space between numbers. The Number Printer parent class has two constructors: //initializes the three digit, lo zero Number Printer(); // initializes each of the digits NumberPrinter(int firstDigit, int SecondDigit, int ThirdDigit.); And three "et." Cunctions void setFirst Digit(int x); void set secondaiyit(int x); void setThirdDigit(int x); As well as a pure virtual function virtual void print.() - 0; 0 This function will need to be overridden by each of your subclasses. Constructors for your subclasses should not re define the construction rather they should call the base constructor with the appropriate arguments (if any). Your print function (overriding) for each subclass may possibly need to call other functions that you write. If so, make these private members of the class Note: You may only use the cout stream in your print() function. Do not invoke other outside libraries to print on the screen. The print) function must stream the output to std.out. Main Function You should create a main() function to test your classes. It should do the following: a : . 1) Create a Mediurn Printer object with the default constructor, then print it out 2) Create SmallPrinter and Large Printer objects with values (579) and print them both out . 3) Change the values in the Large Printer object to (478) using the setter operations and print it out again. . 4) Create an array of painters to nine Number Printer objects Make the first three bc Small Printer objects with the values (012). (8,4 5). (67B). The next three will be MediumPrinter objects with the same series of values, and the last will be Large Printer objects with the same series of values. 5) Write a forloop to print out the values of the array of Number Printer objects Normally for Parent classes and Child classes, you would have a separate.cpp/h file for every class. Since this assignment involves 4 classes, you may put all classes in one.cpp/.h pair. Your main should go in the main.cpp file, but put all class declarations in NumberPrinter.h and all member function definitions in NumberPrinter.cpp. 20.29 Programming Project #1: Number Printer Programming Project 1 This is a more comprehensive programming project. You should should have formal code that is properly CONTWTIented and include headers. Your comments will be evaluated after your code is submitted. The following multipliers will be applied Proper Comments: 100% Minimal Comments 80% No Comments 50% Task: You are to design and build a number-printer class hierarchy. There is one virtual parent class and three concrete subclasses. The parent class should be called Number Printer. The three subclasses are called SmallPrinter, MediumPrinter, and Large Printer. Each class takes in three one-digit numbers 109] and prints it out in various formats. If the three numbers were 1, 2 and 3, then Small Printer would print 1 2 3 Medium Printer would print: 1 1 1 Each digit is four spaces wide and seven tall with one space between numbers - it is hard to see the spaces with the 'T' digit. Think of it as ani LCD display with two dashes per element. Large Printer would print Each digit is five spaces wide and nine tall with one space between numbers. The Number Printer parent class has two constructors: //initializes the three digit, lo zero Number Printer(); // initializes each of the digits NumberPrinter(int firstDigit, int SecondDigit, int ThirdDigit.); And three "et." Cunctions void setFirst Digit(int x); void set secondaiyit(int x); void setThirdDigit(int x); As well as a pure virtual function virtual void print.() - 0; 0 This function will need to be overridden by each of your subclasses. Constructors for your subclasses should not re define the construction rather they should call the base constructor with the appropriate arguments (if any). Your print function (overriding) for each subclass may possibly need to call other functions that you write. If so, make these private members of the class Note: You may only use the cout stream in your print() function. Do not invoke other outside libraries to print on the screen. The print) function must stream the output to std.out. Main Function You should create a main() function to test your classes. It should do the following: a : . 1) Create a Mediurn Printer object with the default constructor, then print it out 2) Create SmallPrinter and Large Printer objects with values (579) and print them both out . 3) Change the values in the Large Printer object to (478) using the setter operations and print it out again. . 4) Create an array of painters to nine Number Printer objects Make the first three bc Small Printer objects with the values (012). (8,4 5). (67B). The next three will be MediumPrinter objects with the same series of values, and the last will be Large Printer objects with the same series of values. 5) Write a forloop to print out the values of the array of Number Printer objects Normally for Parent classes and Child classes, you would have a separate.cpp/h file for every class. Since this assignment involves 4 classes, you may put all classes in one.cpp/.h pair. Your main should go in the main.cpp file, but put all class declarations in NumberPrinter.h and all member function definitions in NumberPrinter.cppStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started