CS 1150 – Lab #3 – Representing Numbers
-
Upload
hilel-bright -
Category
Documents
-
view
28 -
download
0
description
Transcript of CS 1150 – Lab #3 – Representing Numbers
![Page 1: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/1.jpg)
CS 1150 – Lab #3 – Representing Numbers
TA – Sanjaya Wijeratne
E-mail – [email protected]
Web Page - http://knoesis.org/researchers/sanjaya/
![Page 2: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/2.jpg)
2
TA Labs, Office Hours Laboratory Polices
• Lab Hours• 2:30 PM - 4:20 PM, Monday at Room 320 - Oelman Hall
• TA Office Hours• 4:45 PM - 5:45 PM, Monday at Room 316 - Russ Engineer Center
• By appointment – Please email to [email protected]
• Refer to CS 1150 Course Syllabus for Class and Laboratory Policies• Zero tolerance policy for Academic Misconduct – All parties will get
0% marks CS 1150 - Lab 3 – Representing Numbers
![Page 3: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/3.jpg)
3
Lab #3 Overview
• Learn How Negative Numbers are Represented in Computers• Sign-Magnitude and Two’s Complement Representations
• Learn How Colors and Text are Represented in Computers
• Complete Section 3A – Ex 1, Section 3B – Ex 1 and Ex 3
• Lab #3 Due Date - Feb 10, 2014 11:55 AMCS 1150 - Lab 3 – Representing Numbers
![Page 4: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/4.jpg)
4
How to Submit Lab #3
• Hard copy (Preferred)• When you complete, hand it over to me
• Pilot• Go to Pilot Course Page and Use Dropbox Submission Link to upload your files
• My Mailbox at CS Department • Go to CS Department Front Desk and ask them to put your assignment in my
mailbox. – Please write my name on your assignment (TA – CS 1150 – Sanjaya Wijeratne)
CS 1150 - Lab 3 – Representing Numbers
![Page 5: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/5.jpg)
5
Sign-Magnitude Representation
• Sign-Magnitude Representation• Sign – Ordering of the number (Positive or Negative)
• Value – Magnitude
Source – Chapter 3 by Chris Fickert
CS 1150 - Lab 3 – Representing Numbers
![Page 6: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/6.jpg)
6
Two’s Complement
• MSB Represents the Sign• Negative – MSB is 1
• Convert numbers to Two’s Complement• Invert the bits and add 1
CS 1150 - Lab 3 – Representing Numbers
Source – Chapter 3 by Chris Fickert
![Page 7: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/7.jpg)
7
Lab #3 – Section 3A
• Run Negative Binary Numbers Applet
CS 1150 - Lab 3 – Representing Numbers
![Page 8: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/8.jpg)
8
Lab #3 – Section 3A Ex 1 Question 9
CS 1150 - Lab 3 – Representing Numbers
![Page 9: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/9.jpg)
9
Representing Text
• ASCII Character Set • 7 bits to represent a character + 1 check bit
• First 32 ASCII characters are special purposes – Eg Tab, Return
• Unicode Character Set• 16 bits to represent a character
• Can represent every character in every language in the world
• 8 Bits = 1 Byte
CS 1150 - Lab 3 – Representing Numbers
![Page 10: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/10.jpg)
10
Lab #3 – Section 3B Ex 1 Question 6
• Think about the relationship you found between upper case letters and lower case letters in question 5• Assume you have to write an applet
• What would be the input to your applet program?
• What would be the output you show to the user?
• Now try to answer question #6CS 1150 - Lab 3 – Representing Numbers
![Page 11: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/11.jpg)
11
Additional Help
• Chapter 3 Slides by Mr. Chris Fickert discussed in Class
• Chapter 3 of Course Text Book – Data Representation
CS 1150 - Lab 3 – Representing Numbers
![Page 12: CS 1150 – Lab #3 – Representing Numbers](https://reader035.fdocuments.us/reader035/viewer/2022062321/568135cd550346895d9d31fd/html5/thumbnails/12.jpg)
12
Questions ?
If you have questions, please raise your hand, Colin or I
will come to help you
CS 1150 - Lab 3 – Representing Numbers