Starting from:

$30

CSCE 240-003 – Program One

CSCE 240-003 – Program One

Program Purpose
Convert a numeric value expressed in a base between 2 and 9, inclusive, to the
base 10 expression of that value.
Overview
In a positional numeration system with base b, each position represents a power
of b. In the decimal system, which is a positional numeration system with base
10, each position represents a power of 10. So, for example, the decimal number
4809 represents 4 · 103 + 8 · 102 + 0 · 101 + 9 · 100.
Similarly, in binary (positional numeration system base 2), each position
represents a power of 2. For example, the binary number 11001 represents 1 * 2^4
+ 1 * 2^3 + 0 * 2^2 + 0 * 2^1 + 1 * 2^0. So, the value 11001 in binary would be
expressed as 25 in decimal.
For more detail and examples about positional numeration systems, read over the
“Numeration Systems” PDF.
Your program should accept two integers input from the standard input device
(use cin). The first integer is a numeric value and the second integer is the
base in which that number is expressed. Your program should then output the
number expressed in decimal (using cout).
Example Input/Output Pairs
Input: 11001 2
Output: 25
Input: 132 8
Output: 90
Input: -112 7
Output: -58
This program only needs to convert numbers with bases between 2 and 9,
inclusive. If a base input is outside of this accepted range, your program
should output “Base Not Accepted” to the standard output device (using cout).
Example Input/Output Pairs
Input: 105 16
Output: Base Not Accepted
The number of unique digits in a positional numeration system is equal to the
base. In base 10, for example, the valid digits are 0, 1, 2, 3, 4, 5, 6, 7, 8,
and 9. And the binary numeration system uses the unique digits 0 and 1. If the
number input uses invalid digits for the base entered, your program should
output “Invalid Digit(s) In Number” to the standard output device (using cout).
Example Input/Output Pair
Input: 130 2
Output: Invalid Digit(s) In Number
Specifications
- All output should be directed to the standard output device using cout.
- All input should be accepted from the standard input device using cin.
- Do not prompt for the input values.
- All of your source code for the program must be contained in a single file
named program1.cc
- You will submit program1.cc to the assignment in Blackboard.
- Programs must compile and run on a computer of the instructor’s choosing in
the Linux lab (see your course syllabus for additional details).
Testing
A python script, to_decimal_tester.py, has been provided for you to test your
program with 5 sample input/output pairs. In order to use the tester, you’ll
need access to a python3 interpreter. Ensure that the tester and your program1
executable are in the same directory, and python3 is in your path. The commands
to run the tester are given below:
python3 to_decimal_tester.py 1
python3 to_decimal_tester.py 2
python3 to_decimal_tester.py 3
python3 to_decimal_tester.py 4
python3 to_decimal_tester.py 5
Your program will be graded using a similar python script with different
input/output pairs.
Grade Breakdown
Style: 1 point
Documentation: 1 point
Clean compilation: 2 points
Runs correctly with sample data provided in to_decimal_tester.py: 2 points
Runs correctly with instructor’s test data set 1: 2 points
Runs correctly with instructor’s test data set 2: 2 points
The penalty for late program submissions is 10% per day, with no program being
accepted after 3 days.

More products