Lab 7 - Structured Programming |
Overview |
Our goal today is to get practice with structured programming. Nothing complicated is built all at once, and this includes programs. While you may be able to get away with writing simple programs directly from start to finish, as the problems we solve become more complicated a little discipline in thinking about the problem first will pay dividends in the time you'll save.
|
Demo |
Here's where we work together on the solution to last week's lab. If you don't understand anything, stop me! |
Playing on... |
This week, let's extend the music program from last week. Download three track
listing files into your lab7 directory by executing the following
commands:% wget www.cs.indiana.edu/~jpr/i211/labs/lab7/files/Beatles.txt % wget www.cs.indiana.edu/~jpr/i211/labs/lab7/files/DireStraits.txt % wget www.cs.indiana.edu/~jpr/i211/labs/lab7/files/LedZeppelin.txt Take the three methods you wrote last week ( determine_total_time() , determine_total_size() ,
and determine_longest_song() ) and put them in a file
called musicsubs.pl .Do this:
Write a program called newmusic.pl . Use the line require
'musicsubs.pl'; , which will allow you to use the methods you defined in
that file. Then write code that calls these methods on every file
in @ARGV , printing out the total time, total size, and longest song
in each.
|
Turn in your assignment |
As usual, let's make a tarball of your assignment files (make sure they are ALL in the lab7 directory!) For this lab, you should have the following files:
jpr@sulu (i211/lab7) $ cd .. jpr@sulu (i211) $ tar czv lab7 > lab7.tar.gz music.pl submusic.pl jpr@sulu (i211) $ You should then download this Okay, that's it! Have a good weekend. |