Question: CS 1 3 1 5 Computer Programming Assignment Two ( 2 0 2 4 - 2 5 Sem. A ) Deadline: 2 7 - Nov
CS Computer Programming
Assignment Two Sem. A
Deadline: Nov:Week Wed No Late submission will be accepted
Problem description
From time to time, in magazine newspapers, there are arithmetic
puzzles like the one on the right hand side. The puzzle replaced digits
with alphabets eg X and players need to work out a feasible solution.
For instance, in the puzzle on the right, X so that
In this assignment, we are not going to solve the puzzle; but instead, we need to verify
a given solution and report whether it is correct or not. For simplicity, we only
consider addition of terms The detailed requirements are as follows:
First the program will read in a singleline solution:
The line contains chars, packed with interlaced alphabets AZ and the
corresponding digits in any order. egABDCX
All alphabets are unique and is always in uppercase.
The solution contains ALL alphabets used in the puzzle and maybe more
Then the program reads in the number base:
The program should support any base from binary to decimal
The program then reads in the total line like the X in the example:
The total line contains alphabets digits
The total may or may not be in the simplest form egX
Then the program reads in the number of terms N to add:
N can be which means no addition is needed.
Then N lines follows, with one term per line:
Each line contains alphabets digits
Each line may or may not be in the simplest form egX
It is guaranteed that the sum of the N terms will not exceed digits.
The program will then report the finding:
Error if the mapped solutioninput lines contains illegal digit under the
given base. eg In base or XX with a mapping of X
Correct if the mapping in the solution line can solve the puzzle.
Wrong if the addition result is numerically different from the solution line.
X
X
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
