EC327 2009 Lab2

EC327 2009 Lab2 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EC327
Introduction
to
Software
Engineering
 Lab
#2
–
Due
Tuesday
Oct.
13,
2009
(Monday
Schedule)
‐
8
pm.
 Name:
___________________
 BUID:
___________________
 Lab
guidelines:
 You
are
expected
to
do
individual
work
on
lab
assignments.

You
are
welcome
to
discuss
the
general
 approach
with
classmates,
but
all
final
work
must
be
done
individually.

Please
refer
to
the
Collaboration
 section
of
the
class
syllabus.

Labs
should
be
demonstrated
to
the
Lab
Assistant
or
the
U/GTF
during
lab
 hours
in
PHO
307
(unless
otherwise
indicated),
and
all
code
must
be
printed
out
and
handed
in
along
with
 this
grading
sheet
at
the
same
time.

 
 Section
1
[50
points]
 From
Wikipedia:

In
mathematics,
Pascal’s
Triangle
is
a
geometric
arrangement
of
the
 binomial
coefficients
in
a
triangle.

It
is
named
after
the
mathematician
Blaise
Pascal
in
 much
of
the
Western
world,
although
other
mathematicians
studied
it
centuries
before
 him
in
India,
Persia,
China,
and
Italy.
 Here
are
the
first
5
rows
of
the
Pascal’s
Triange:
 1
 1
1
 1
2
1
 1
3
3
1
 1
4
6
4
1
 You
are
to
write
a
program
the
computes
Pascal’s
Triangle.

If
no
arguments
are
passed
 to
the
program
from
the
command
prompt
then
the
first
16
rows
are
calculated
and
 displayed
on
the
screen,
but
if
a
number
is
passed
to
it
from
the
command
prompt
it
 calculates
only
the
nth
row
of
Pascal’s
Triangle
(n
<=
100).

The
program
must
meet
the
 following
requirements:
 i. The
output
of
nth
row
must
be
displayed
on
the
screen
and
written
in
a
file
 which
is
appropriately
named
nth_row_of_Pascals_Triangle.txt,
where
nth
 row
can
range
from
1st
to
100th.

The
output
written
to
the
file
does
not
 need
to
be
center
formatted.
 The
program
must
use
a
combination
of
loops,
recursion,
and/or
arrays,
 explain
why
you
did
or
did
not
use
each
of
the
three
methods.
 The
first
16
rows
must
be
displayed
in
a
formatted
centered
text.
 At
some
point
the
numbers
are
going
to
get
very
large,
think
about
the
 variable
types
you’ll
use
and
how
you’ll
display
those
numbers!
 Your
program
must
check
the
user
input
for
validity,
both
in
range
and
in
the
 fact
that
it
is
indeed
a
number.
 The
program
must
be
fully
commented
and
use
appropriate
programming
 style
(CamelCase,
indentation,
etc.)
 ii. iii. iv. v. vi. EC327
Introduction
to
Software
Engineering
 Lab
#2
–
Due
Tuesday
Oct.
13,
2009
(Monday
Schedule)
‐
8
pm.
 vii. viii. [5
pt
Extra
credit]
Programmatically
create
a
folder
named
Outputs
and
write
 the
files
into
that
folder.
 [5
pt
Extra
credit]
If
the
file
exists,
prompt
the
user
whether
she/he
wants
to
 overwrite
it
with
the
new
file.
 
 
 [









]
pts
 Section
2
[50
points]
 Write
a
program
that
reads
in
any
text
file
and
creates
a
histogram
of
all
the
words
that
 are
present
within
that
text.

You
must
use
a
2‐dimensional
array,
where
the
first
 element
contains
the
word
and
the
second
element
contains
the
number
of
occurrences
 of
that
word.

Once
you’ve
read
and
analyzed
the
file
to
build
the
2D
array,
you
should
 then
pass
the
array
to
a
second
function
which
uses
that
information
to
generate
and
 display
a
histogram.

The
histogram
should
look
as
follows:
 this:
 is:
 word:
 hello:
 *
 10%
 *****





50%
 **
 20%
 ***
 30%
 Your
program
should
discount
any
punctuation,
but
include
numbers,
and
the
filename
 must
be
passed
to
the
program
from
the
command
prompt.

If
the
file
does
not
exist
the
 appropriate
error
message
should
be
given.

Try
passing
it
some
of
the
rows
you
have
 generated
from
the
Pascal’s
Triangle,
there
are
some
very
interesting
numerical
 properties
which
are
associated
with
the
Pascal’s
Triangle..
 
 Extra
Credit
[20
points]


 Email
yourself
the
results
of
the
histogram!

When
you
call
your
program,
pass
the
 filename
as
well
as
your
email
name
from
the
command
prompt.

Research
the
system and mail
command,
as
well
as
unix
pipes
and
redirects
(|,
<,
>),
see
if
you
can
come
up
 with
a
way
of
easily
emailing
yourself
the
results.
 
 
 Please
print
and
staple
all
source
code
to
this
grading
sheet
when
handing
in.
 Date
Handed
in:
___________
 
 Grader:
___________
 
 Score:
___________
 [









]
pts
 [









]
pts
 ...
View Full Document

Ask a homework question - tutors are online