Assignment 01

Due: Wednesday, August 30, 2017 at noon 50 pts.

For this assignment, you will type and submit three (3) algorithms. Make your algorithms clear and concise step-by-step procedures that solve the problems given. I think that each of these should require at least three steps and probably (though, possibly) no more than twenty steps. Think about your answers.

You are to edit a single file in your DFS account using an editor (I like jpico) that your lab instructor has shown you in your CS 1580 lab #1( or #0 depending on who your lab instructor is). First though, make a new directory under your home directory and call it cs1570 (from home, type mkdir cs1570 and enter). Change into that directory (cd cs1570). Now, make a new directory under this cs1570 directory and name it hw1. Change into that directory and then create the file with your answers in it, naming it something clever like "hw1.txt". The .txt extension is used for files that are nothing but text (not to be compiled). What ever you name that file, make sure it has a .txt extension. This assignment is NOT C++ programming. You are not to compile this. In this (one and only) file (for this assignment), you are to number your answers for the following 3 problems. Also, be sure to put your name and section letter at the top!!

  1. Write an algorithm for adding two three digit positive integers. This procedure should be very detailed and not skip any steps that a mindless machine would need to be told; even a gorilla should be able to understand it.

  1. In an effort to make advising at the university easier and cheaper, the administration has opted to hire a gorilla to be an adviser. Gorillas work cheap; bananas are cheap. But gorillas lack the reasoning capabilities of most faculty who currently do advising, so they need an easy to follow "recipe" for building a good schedule for a student. You are to write an algorithm that the gorilla can employ to create a sufficient schedule. The constraints are as follows:

    • There are 3 categories of courses and any schedule must contain at least one course from each of these categories

    • Each course has a credit hour value of from 1 to 4 credits.

    • An acceptable schedule must have at least 12 credit hours but no more than 20 credit hours.

    • A schedule must not violate prerequisites. That is, if course A requires course B, then both A and B cannot be in the same schedule.

    • No schedule can contain repeated courses.

To submit this homework, you are going to use the cssubmit program for your section of cs1570. This assignment will be used for all sections. Your answers should be written up using your favorite editer in a subdirectory called hw1 hanging off your cs1570 subdirectory. Remember: make a different directory under cs1570 for every one of your assignments. From that directory, at the UNIX command, type "cssubmit 1570 a 1" if you are in section a. If you are in section b, type "cssubmit 1570 b 1". If you are in section c, type "cssubmit 1570 c 1", etc. (Can you see the pattern?) Hit enter. Of course, when submitting homework #2, your last entry in that command should be a 2. Don't type cssubmit 1570 a h2 or some other variant like that; just the digit 2. Use this scheme for subsequent submissions. If you have any questions about using the editor or submitting, just ask. You can look here for guidance on submitting using the cssubmit command. NOTE: You can submit the same assignments multiple times. If you submit and then remember something you forgot, you can edit your file, save it, then submit again. The new submission will overwrite the old; we won't see the old one. Time stamps on submissions apply to the latest submission. Always run the submit script from the directory in which the file(s) to be submitted reside(s). Any questions, just ask. Remember, there is a due date/time. Try not to exceed that.

  1. A gorilla, named Al, has escaped from the Rolla Zoo. He has cleverly hidden his identity, and thus his subsequent capture, by disguising himself as a traffic cop and taken up residence in the middle of a 4-way intersection directing traffic. He wants to stay a free and healthy gorilla and so needs to avoid the perils of directing traffic. His chief concern is that someone will be angry with his performance and discover that he is indeed a gorilla and not a traffic cop. If that happens, he's likely to be tranquilized (he hates that!) and thrown into gorilla jail (the zoo). So, he has to do his job to the utmost of his ability...he has to keep people in their cars happy. The happiness constraints he must live with are:

    1. no line of cars can be longer than 10 in length

    2. no car should wait longer than 1 minute

Write an al-gorillam that maximizes Al's chances for freedom. That is, write a set of instructions that the gorilla can follow to direct traffic at this intersection in such a way that will most likely keep everyone happy and him out of jail.