Introduction to Programming

laboredbumbaileyΛογισμικό & κατασκευή λογ/κού

7 Ιουν 2012 (πριν από 5 χρόνια και 5 μήνες)

541 εμφανίσεις

9/27/11
1
Introduction to Programming

AA 2011-12
Lab 1

28 September 2011
Teaching Assistant


Name

o

Mehdi Elahi



Language

o

English



Lab schedule

o

Wednesday 2 pm - 4 pm, E431



Contact

o

Faculty of Computer Science, Piazza Domenicani 3, Office 2.14,
telephone: +39 0471 016232, email:

o

mehdi.elahi@stud-inf.unibz.it



Office hours

o

Wednesday 5:00 pm – 7:00 pm
9/27/11
2
Teaching Assistant


Name

o

Floriano Zini



Language

o

Italian



Lab schedule

o

Wednesday 4 pm - 6 pm, E431



Contact

o

Faculty of Computer Science, Piazza
Domenicani
3, Office 2.18, telephone:
+39 0471 016236, email:
floriano.zini@unibz.it



Office hours

o

Wednesday 1:45 pm – 3:45 pm
o

Send email for appointment
Teaching Assistant


Name

o

Markus Innerebner



Language

o

German



Lab Schedule

o

Wednesday 4 pm - 6 pm, E531



Contact

o

Faculty of Computer Science, Piazza Domenicani 3, Office 2.11
telephone: +39 0471 016143,
email:
markus.innerebner@inf.unibz.it

web:
http://www.inf.unibz.it/~minnerebner/



Office hours

o

Wednesday 2:15 pm – 3:45 pm
9/27/11
3
Organization of the lab (from Lab 2)
1.

Solution of the assignments given the previous lab
(
~20
mins
)

2.

Presentation of exercises related to the last 2 lessons
(
~40
mins
)

3.

Assignment of similar exercises to the students
(
~60
mins
)

o

Assignments can be done either in the lab or at home

4.

Correct solutions of assignments adds
up to

2 points
to
the final mark

5.

Solutions of assignments have to be sent to the
teaching assistant
by email
How to send solutions of assignments
1.

create a folder named
<
assignmentNumber
>_<
yourLogin
>

e.g.
01_fzini


2.

save the Java source file inside this folder
e.g.
Assignment1.java

3.

pack the folder in a zip file including the directory (zip
option)

In
linux
you do it as follow:
zip 01_fzini.zip 01_fzini
9/27/11
4
How to write and run
programs in Java


We use the
Java
programming language to write
programs




An
IDE
(Integrated Development Environment) is a
software application that provides
facilities
to computer
programmers
for
software
development. An IDE
normally consists of:

o

a source code
editor

o

a
compiler
and/or an
interpreter

o

build
automation tools

o

a
debugger
NetBeans




We adopt the
NetBeans
IDE to write programs in
Java

o

Website:
http://netbeans.org/

o

Download:
http://netbeans.org/downloads/index.html



Quick start

o

Start a web browser (e.g., Firefox, Explorer)

o

Go to the tutorial web page

§

http://netbeans.org/kb/docs/java/quickstart.htmlStart
NetBeans

o

Put the two windows (browser and NetBeans) side by side

o

Try to do yourselves what I am doing
9/27/11
5
Now it
`
s your turn


Start
NetBeans




Create and run new Java application called
l
HelloBolzanoFromMe
z




The output should be, for example:

o

Hello World

o

from Floriano Zini



Send the result to me by email as previously
explained
NetBeans
is not everything :-)


You can also write a Java program using a text
editor and compile and run it from the command
line



Which text editor?

o

As you please

o

2 examples:

§

Windows:
notepad

§

Linux:
pico



Exercise:

o

Use the text editor of your choice and write again the
l
HelloBolzanoFromMe
z
application



How to compile and run programs from command
line?

o

Will see it in the next labs
9/27/11
6
Exercises on number conversion
1.

Convert to decimal format the following binary numbers:
11, 11001, 10001000, 11111, 10011001100

2.

Convert to binary format the following decimal numbers:
6, 16, 255, 45678, 128302
3.

Convert to hexadecimal format the following binary numbers:
100, 1010, 11111, 10101010000, 110000101101

4.

Convert to binary format the following hexadecimal numbers:
B, 3F, 100, AA10, 3DA34

Exercises
1.1
Describe the hardware components of your personal
computer or of a computer in a lab to which you have access.
Include the processor type and speed, storage capacities of
main and secondary memory, and types of I/O devices. Explain
how you determined your answers.


1.5
If a language uses 26 characters, 14 symbols, and 10
numerals how many bits would be required to represent that
language? why?
9/27/11
7
Exercises for you

1.4
If a picture is made up of 256 possible colors, how many
bits would be needed to store each pixel of the picture? Why?


1.6
How many Kilobytes are required to represent the following:



10 MB



1 GB



2 TB



1 PB


1.11
What is the total number of communication lines needed
for a fully connected point-to-point network of eight computers?
Nine computers? Ten computers? What is a general formula for
determining this result?



Exercise for you

1.14
Use a Web browser to access information through the
Web about the following topics. For each one, explain the
process you used to find the information and record the specific
URLs you found:




the
Bolzano
-Bozen Foxes
ice hockey team



wine production in the Province of Bolzano



the subway systems in two major European cities



vacation opportunities in the South Tyrol
9/27/11
8
Next Lab


English

o

Thursday, October 6th, 8.30 am - 10.30 am, E431



Italian

o

Thursday, October 6th, 8.30 am - 10.30 am, E331



German

o

Thursday, October 6th, 8.30 am - 10.30 am, E531