number representation, data types and elementary programming shirley moore cs 1401 february 5-7,...

11
Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Upload: brittany-rose

Post on 04-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Number Representation, Data Typesand Elementary Programming

Shirley MooreCS 1401

February 5-7, 2013

Page 2: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

AgendaFeb 5• Final syllabus• Answers to questions about the course• Followup on multicore• Followup on logic gates/circuits• Finite data representation• Discover/invent how to represent negative integers• Assignments for next classFeb 7• Announcements (BlackBoard, Feb 12 Seminar, today’s lab, Exam 1)• Binary Homework• Overflow• Data types• Dr. Java interactive window• Assignments for next class• Quiz 2

Page 3: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Questions about the course from Qualtrics Survey

• Will this course help prepare me for future classes in Computer Science?

• Are we going to survey every detail of Java or are we going to have general knowledge of it?

• How in depth will the course get? By the end of the course, how proficient will I be at computer programming?

• Will we be exploring other programming languages or just Java?• Will there be a review for the test and what is the testing

format?• Can I get a work-study job in these courses helping Tas or the

professors?

Page 5: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Logic Gates and Circuits

• Six basic logic gates• Trace circuit operation

Page 6: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Data Representation

• What can you represent using n bits?• How can we represent negative integers?• How does the processor know how to

interpret a given bit pattern?

Page 7: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Assignments for Thursday

• Redo questions 7 and 8 on quiz 1 (if you didn’t already get full credit)

• Binary and circuits homework (come prepared to do problems on board)

• Read Chapter 2, sections 2.1-2.8.– Be sure you can answer check-up questions– Write down any questions you have

• Quiz 2 on Thursday– May include lecture/lab/reading material

Page 8: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Overflow

• Overflow examples• How can you detect when overflow occurs?– When doing addition by hand?– By adding a single gate to your adder/subtractor?

• Ariane 5 explosion– http://www.youtube.com/watch?v=kYUrqdUyEpI

Page 9: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Data Type

• The data type for a variable indicates – size of the data – how to interpret the bit pattern

• Basic data types in Java– byte (8-bit integer) – short (16-bit integer)– int (32-bit integer)– long (64-bit integer)– float (32-bit real)– double (64-bit real)– char (16-bit character)

Page 10: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Dr. Java

• Example of an Integrated Development Environment (IDE)– Enables editing, compiling, running, and

debugging a program from a Graphical User Interface (GUI)

• Dr. Java has an Interactive Window that acts as a Java interpreter.– Can develop and test program statements and

then copy and paste to editor window

Page 11: Number Representation, Data Types and Elementary Programming Shirley Moore CS 1401 February 5-7, 2013

Assignments for Tuesday Feb 12

• Reflective writing on Ariane 5 reading assignment• Read Section 2.9 – 2.15– Answer Checkpoint questions– Write down any questions you have– Try programming exercises 2.2, 2.4 on p. 75

• Read Lab 3 (posted by Friday) and try to write down an algorithm to solve the problem.

• Start preparing for Exam 1 which will be Feb 14