Presentation is loading. Please wait.

Presentation is loading. Please wait.

HW1 Report Xing Wang. HW1-PR1 Question Not Good Formatted Example.

Similar presentations


Presentation on theme: "HW1 Report Xing Wang. HW1-PR1 Question Not Good Formatted Example."— Presentation transcript:

1 HW1 Report Xing Wang

2 HW1-PR1 Question

3 Not Good Formatted Example

4 Perfect Answer

5 HW1-PR2 your program should read an operand, an operator as a single character +-*/, and another operand, separated by spaces. Output the results. For example: – 100 + 3.14, output 103.14 – 4 * 5, output 20

6 HW1-PR2 Test Cases InputOutput 1 + 23 1 - 2 1 * 22 4 / 22 1 plus 22 1 minus 2 1 mul 22 4 div 22 1.1 + 2.13.2 1 / 0Warning : Divided by 0 is invalid.

7 HW1-PR3 Exercise 11 on page 86, but with the following modifications: instead of using U.S. currency, write your program for the Euro. Note that Euro coins come in different denominations from U.S. coins; there are 8 that you must account for. Report to the user the individual counts (as in the original problem) and the sum in Euros and cents (instead of dollars and cents). In addition, convert the final value to U.S. dollars using a recent exchange rate (do not worry about rounding the result, for now).

8 HW1-PR3 Test Cases Cent 1Cent 2Cent 5Cent 10 Cent 20 Cent 50 Euro 1Euro 2Total Euro Total Dollar 121000000.10.136 0003110011.36 000000431013.6 3112110011.36 121021141013.6 367934221013.6 3627865579472214100136 58563080739428411651113810001360 43507509408407812146047256716151000013600 167498568844799148305709957132156521942910010 0 13613 6

9 HW1-PR4

10 HW1-PR4 Signed Integer 01111111111111111111111111111111 00000000000000000000000000000001 Max Integer : 2,147,483,647 1 00000000000000000000000000000000 0 11111111111111111111111111111111 10000000000000000000000000000000 Min Integer : -2,147,483,648

11 The negative integer The absolute value of negative integer is the complementary of the binary representation plus 1. 11111111111111111111111111111111 00000000000000000000000000000000 Complementary of -1 00000000000000000000000000000001 Absolute value of -1, Complementary of -1 plus 1

12 HW1-PR4-Analysis 1 10^10 (1001010100000010111110010000000000 ) 1001010100000010111110010000000000

13 HW1-PR4-Analysis 2 10^12, is a negative value as the sign bit is 1. 1110100011010100101001010001000000000000


Download ppt "HW1 Report Xing Wang. HW1-PR1 Question Not Good Formatted Example."

Similar presentations


Ads by Google