Lecture11-w04-LIN-02132019-nestedIf-Expressions.pdf - Computing I COMP.1010 Fall 2019 Lecture 11 Two’s Complement to Decimal nested if-else By Sirong

Lecture11-w04-LIN-02132019-nestedIf-Expressions.pdf -...

This preview shows page 1 - 10 out of 28 pages.

Computing I By: Sirong Lin, PhD COMP.1010, Fall 2019 University of Massachusetts Lowell University of Massachusetts Lowell Lecture 11: Two’s Complement to Decimal, nested if-else,
Image of page 1
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 2 Due Date Daily 09 09-27-2019 (F), 9:00pm Week 04 Practice 09-29-2019 (Su), 9:00pm Week 05 Readings MWF, 9:00am Two’s complement HW 09-30-2019 (M), before class Daily 10 09-30-2019 (M), 9:00pm Daily 11 10-02-2019 (W), 9:00pm HW1 10-02-2019 (W), in class Program 1 10-09-2019 (W), 9:00pm
Image of page 2
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Program 1 Start working on the Program early! Don’t wait till the last minute. One day is not enough for most students. Due: 10-09-2019 (W), 9:00pm Worth: 50 points 3
Image of page 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Program 1 4
Image of page 4
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Outline Two’s Complement Nested if-else 5
Image of page 5
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Convert Two’s complement to Decimal 6
Image of page 6
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal step 1: check the sign bit 0: positive number, use the regular method of converting unsigned binary to decimal by adding the place values for each bit. Stop. 1: negative number, continue to Step 2-4; step 2: invert all the bits step 3: add 1, use the regular method binary -> decimal by adding the place values for each bit step 4: add the negative sign to the decimal number 7
Image of page 7
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal (Cont’d) step 1: check the sign bit positive, add place values + (1+2+4) = +7 8 Convert 0111 two’s complement to decimal
Image of page 8
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal (Cont’d) 9
Image of page 9
Image of page 10

You've reached the end of your free preview.

Want to read all 28 pages?

  • Fall '15

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors