Lecture 6 – September 14th
Notes courtesy of Brent
Class
Notes
-There
are now 2 copies of the Ada 95 Language reference
manual in CISAT Library available for 2 hour loans
- There
is also an additional Ada Data Structures text on 2
hours reserve in
the CISAT library.
-When
using FIREFOX or
Internet Explorer, you may not get the appropriate .exe extension upon
downloading the compiler. If the
download doesn’t have the extension .exe it won’t work properly
-Email
Dr. Adams if you notice that the notes are not on the website.
-Get
used to going to ADA 95 Reference Manual online.
-When
you declare a new type of an array, REMEBER TO DECLARE A VARIABLE OF THAT TYPE!
-When
you want to make a data file, for your program to read from make it a plain
text file and then you can name it .in or .out
-When
you submit files to Dr. Adams name your files using your name and the number it
says in the assignment
- Yes,
you can submit multiple files to the drop box.
You can try zipping them together if you have multiple files. The first time you
do this please also submit them separately so we can see if the zip works.
-https://users.cs.jmu.edu/adamses/web
is our CS 240 website.
-If your’re having problems send Dr.
Adams a note or put it on the discussion board found on Blackboard.
-The command to go the next line on a read statement is Ada.text_io.skip_Line() -- used in your exception handler when expecting an
-- integer and run into a character and the
data is one element per line
-- if all of the data is on a single line, use Ada.text_io.get(ch); where
-- ch has been
declared as a character to remove the problematic element from
-- the input buffer.
-If you
know there are only going to be n numbers, declare an integer constant
representing the desired number of items
-need a loop up to that constant
-Alternative way other than looping
-ada.integer_text_io.get(num1,num2,num3,num4,num5);
-For
blackboard digital dropbox, you must ADD and then
SEND!!!!
-You can
not index just an integer, you have to declare a array
type to be able to index
-Slides
from today's lecture on chapter two can be reached via this link .
Representation
of integers in the computer
- Sign
magnitude
-One's
Complement you have all positive numbers and +0 and a -0
-Two’s
complement has only 1 representation for zero so it has one more number on the
negative side than the positive side.
-Here is
an example(I, Dr. Adams will fill this in later)
We discussed some of the
slides for Chapter 2 – should study them over the weekend
-plus
and minus sign are overloaded operators
-between two numbers means subtraction (infix -)
-before a single number means negative (prefix -)
- /= is a not equal (in other words it is
equivalent to != in JAVA)
-you get
attributes when talking about integers using the ticks and the tick(things) being attributes
-the advantage of
ticks is you don't have to remember where your beginning or end is of that array - see example program
-Scalar data type has values which are ordered and each value
is atomic
-Character
-Naturals
-Floats
-boolean
is an enumerated data type which is ordered
-Discrete(Ordinal) data type in which each value (Except the
first and last) must have a unique predecessor
and successor
- example are: Integer, character, boolean
-Composite data type is a data type whose elements are
composed of multiple data items(must have component parts)
-String (it is an array of characters)
-Date (has three component parts – month,
day, year)
- array
- record
-Stack
operations include POP, PUSH, PEEK, ISEMPTY, or ISFULL
-You
NEED TO go back and look at the slides and understand them!
-GO look
in the language reference manual for exceptions and figure out how to handle
errors.
- Homework will be posted later.