Due: Friday, Jan. 31, 2020 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 inside your SDRIVE directory and call it cs1570 (from home, change directory to SDRIVE. Then 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!!
Write an algorithm to implement modulo division. You may assume only positive values. So, you say "what the heck is modulo division?" Here are some examples:
5 mod 2 is 1 7 mod 6 is 1 7 mod 5 is 2 3 mod 3 is 0
See the pattern? I didn't think so. Here's a definition: For integers (positive) a and b, a mod b is the remainder after integer division of a by b. So, in the above examples, 2 goes into 5 twice with a remainder of 1, 6 goes into 7 with a remainder of 1, 5 goes into 7 with a remainder of 2, etc.
Life has been good to you so far. Now you have a job, and, you're thinking, life is even better now that you have a paycheck! However, your job has been trying, and a little bit boring. So, you'd like to take up some time developing an algorithm to make the job even easier than it already is. Here's you job: You are the Measure Minister. People in your town, being too stupid to use a yardstick , bring to you all their stuff to measure. Everything is measured in exact inches. (The foregoing fact makes this problem simple, albeit not realistic. Thus, for this problem, you can assume no one will ever bring you anything measuring 3.5 inches, or 78.23 inches, or 9.01 inches, or ...) Your only tool-o-measurement is a piece of string exactly 8 inches long. Write an algorithm that you (or your replacement) may use to measure in the most efficient way all the stuff that the townspeople might bring to you to measure. Remember, they can bring you little things or big things.....or even really big things! Remember, your measures will always be to the nearest inch, and the string you use is exactly 8 inches long.
Here's the deal: You have to get to class at noon. You wake up in the morning according to your alarm clock. Class is 12 miles away from your bedroom. You want to get there in the most economical way and on time. Your modes of transport are:
walking, (max speed 3 mph and not limited to road surfaces)
stupid motor bike, (max speed 10 mph and 70 mpg, but limited to road surfaces)
Abrams M1 tank, (max speed 65 mph, not limited to road surfaces!) Cooooool! But, only gets 0.4 mpg.
Other considerations include:
traffic conditions (you have a traffic radio).
the weather (you also have a weather radio).
You will not want to walk or drive the moped in bad weather. Bad traffic can halt a moped. Nothing can halt an M1 tank.
Write an algorithm that you can use to decide how you will get to class on time with as little monetary expenditure as possible given the above conditions.
To submit this homework, you are going to use git as shown to you either in your first 1580 lab or when you took cs 1500. All sections of cs1570 are using git for submission of homework programs. In your cs 1580 (the labs), you will be using cssubmit, unless your lab instructor changes that. So, remember, submission of assignments is different from lab to lecture!! This assignment will be used for all sections of cs 1570. Your answers should be written up using your favorite editor in a subdirectory called hw1 hanging off your cs1570 subdirectory. Remember: make a different directory under cs1570 for every one of your assignments. If you have any issues using git, contact your grader.