Assignment_10 - hexadecimal(intInput Example>print_it...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science G175 - C++ Programming Assignment 10 Assignment_10.cpp (2 points) Write a base class “number” that holds a single integer value (value of intInput) and contains one pure virtual member function , print_it(). Make this base class abstract in order to prevent its instantiation. Define three derived classes to print the value in hexadecimal, octal, and binary (overriding the print_it() method). Write a program to demonstrate the use of all the derived classes. The user should enter the value to be converted (intInput). In order to demonstrate polymorphism, the code in main() should look like: number * Example; Example = new
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hexadecimal(intInput); Example->print_it(); // compiler takes care of binding and prints the value in hexadecimal delete Example; Example = new octal(intInput); Example->print_it(); // compiler takes care of binding and prints the value in octal delete Example; … For this exercise, the conversion code should be similar to the one used in assignment _9 . Therefore you should again use the stack class provided . In addition to these labs, also review the Word document “Session 10” that has been posted to the website. Please refer to our textbook, parts of chapter “Lesson 12” for additional information. Page 1 of 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online