Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement a C++ Object Oriented Program (OOP) that uses a simple three-option menu to read from two different files. The first file (

Design and implement a C++ Object Oriented Program (OOP) that uses a simple three-option menu to read from two different files. The first file (File1.txt) has only decimal (base 10) values while the second file (File2.txt) contains only binary numbers. A sample run with how the menu should look is shown below.

Choose from the following options by entering 1 3.

1. Convert Decimal to Binary (Read from File) 2. Convert Binary to Decimal (Read from File) 3. Exit

Include an Abstract Class with the name Number_System which includes a pure virtual function named print_out( ). Also, create a class named Conversion that inherits from the class Number_System. Inside the Conversion class include at least the following three functions:

? dectoBinary ( ) --- a Recursive Function that converts a decimal value to Binary

? binarytoDec ( ) --- a Recursive Function that converts a binary value to decimal

? print_output ( ) -- a Non-Recursive Function that displays the correct output either decimal to binary values or the binary to decimal values

Declare your own member variables and or functions that you need in the Conversion class and create at least one object in the main function and make sure that your program reads from either file1 or file2 depending on the users choice. Use the following two files in your program.

Input: File1.txt

76

15 20

35

Input: File2.txt

01001100

00001111

00010100

00100011

Sample output for program depending on choice:

Output for File1:

76 = 01001100

15 = 00001111

20 = 00010100

35 = 00100011

Output for File2

01001100 = 76

00001111=15

00010100=20

00100011=35

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions