[SOLVED] 代写 Design and code a number converter, that can convert a positive decimal integer number among the “base-x” formats, where x=2,3,…, 12:

30 $

File Name: 代写_Design_and_code_a_number_converter,_that_can_convert_a_positive_decimal_integer_number_among_the_“base-x”_formats,_where_x=2,3,…,_12:.zip
File Size: 1375.32 KB

SKU: 5399604944 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Design and code a number converter, that can convert a positive decimal integer number among the “base-x” formats, where x=2,3,…, 12:
•base-2: a string of “0” and “1”. For example, 1010.
•base-3: a string of “0”, “1” and “2”. For example,21210.

•base-11: a string of “0”, “1”, …, “9” and “a”, where the value of “a” is “10”. For example,a783a5.
•base-12: a string of “0”, “1”, …, “9”, “a” and “b”, where the value of “a” is “10” and the value of “b” is “11”. For example,2a5b.
In general, in base-x, there are x digits used to represent the number. The decimal value of a number a3a2a1a0 in base-x is:
a3a2a1a0 = (a3×x3)+ (a2×x2)+ (a1×x1)+ (a0×x0)
For example,the decimal value of a base-3 number 21210 is
(2×34) + (1×33) + (2×32) + (1×31) + (0×30) = 162 + 27 + 18 + 3 + 0 = 210
the decimal value of a base-12 number 2a5b is
(2×123) + (10×122) + (5×121) + (11×120) = 2×1728 + 10×144 + 5×12 + 11 = 4967
Requirements:
•The program recieves an input number in the base-x format (x is specified by the user, the input number has at most 5 digits), then converts this number into a required format (also specified by the user).
•The program can print sufficient guiding message to ask the user to input the number and choose the output format. For example:

Grading criteria:
•Correctness: 3 marks.
The program can correctly print guiding messages, receive inputs, convert the number as required, print the outputs.
•Robustness: 1 marks:
If the program recieves incorrect or self-contradictary inputs, the program can print proper feedback to users and let them retry.
•Good programming style: 1 marks.
The source code are properly structured (e.g., using indents) and well commented.
•Bonus: 1 marks.
Other (useful) features beyond the above requirements. If your program includes any bonus feature, please submit a separate WORD document to clearly introduce it and make sufficient comments in the source code to explain the corresponding codes. 兩個不同進制的數字之和

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 Design and code a number converter, that can convert a positive decimal integer number among the “base-x” formats, where x=2,3,…, 12:
30 $