Muddy Points

 



Q:Is there any way to get input from the user without predefining the type?
Or any way to build in a check to make sure it is of the right type and
avoid an excpetion?

A:
First part: For reading a text string. There is nothing automatic that
converts anything to the correct type.

Second part: If you have a text string and want to make it into a type, put
it into a declare block with an exception handler. There will be an
exception, but it will be taken care of.

S : String (1..80);
Len : Integer;
A : Float;
begin
Get_Line(S,Len); -- reads a line
begin
A := Float'Value(S(1..Len)); -- you can also use float_IO.get
exception
when others => A := -999.0;
end;

Q:On problem #3 of ps #4, do we need to ensure that the day given is valid in
that particular month (ie no Feb. 30)?
A:Yes. You have to ensure that the date falls within the month.
Note: If the year number is divisible by 4, then February has 29 days, but if in addition to that
it is divisible by 100 then it will again have 28 days, but if in addition to that it is divisible
by 400 it again has 29 days. So 2000 is divisible by 400, so February in 2000 had 29 days; 1900 is
is divisible by 100, but not by 400, so February 1900 has only 28 days; February in 2004 will have
29 days.

Q:Does Ada handle the machine language that we're supposed to code in for problem set 3?
A:No, Ada, does not handle the machine language you need to code in for pset 3.
You need to use the simulator (SimpSim) that is available on the course website.

Q:Do the programming assignments in pset 3 need to be done in case
study format?
A:No, the solutions in pset3 do not need to be presented in case study
format.

Q:How can I install GNAT on OsX?
A:You can download the compiler, debugger, etc from
www.macada.org/macosx.html (they just got the domain name
today), and the directions I followed are at
www.greenlime.com/users/adrian.hoe/GnatMacOSX-Installation-HOWTO.shtml
Things to check for when running the carbon bindings installer:
1) Make sure rm is not aliased to rm -i
2) Make sure that if you have ssh keyrings, the key is loaded.
The installer takes a while, even after it says it has a minute
remaining--don't worry about it unless it takes more than about 5
minutes from that point