Assignment 1

Due Date : 9/18 @ 11:59pm

Instructions

Each of you should have a repository in GitHub with the name assignment1-githubHandle. Use this repository and add all your work there. In order to clone the repositories from GitHub to your machine (or watch this video video instructions):

  1. Sign in to GitHub.

  2. On your GitHub home page your Github Handle should appear on the left as a button/drop down menu. Click that button and from the drop down menu select cs2500f14. The GitHub page will then navigate to the class' web page and to the contents that is available to you.

  3. On the right you should be able to see all repositories to which you have been given access. Find the repository whose name matches the pattern assignment1-githubHandle, where githubHandle is your GitHub account name, e.g,assignment1-john123, and click on it.

  4. On the repositories home page look at the bottom right hand corner for a button with the text Clone in Desktop. By clicking on this button your browser will launch the GitHub client that we installed in class and ask for a location on your drive to store the repository.

    If you are not using the GitHub client the clone URL is located above the Clone in Desktop button. Copy the URL and issue the following command on your shell git clone URL.

  5. Create a file and save it under the folder on your drive that you selected in the preceding step.

Remember to push your changes to the GitHub repository often.

Your solutions should be typed in DrRacket's definition window. In the case where

Problem 1

A friend of yours has been monitoring the traffic on their network at home and noticed the following pattern

package number 0 1 2 3 4 ... 10 ... 15
value 1 2 4 8 16 ... ?? ... ??

Guess a formula for calculating the value for a package number.

Check the formula for the first five table entries. If it doesn't work, guess more.

Once the formula works for the first five entries, use it and a calculator or DrRacket's Interactions Window to fill in the two boxes with ?? in the above table.

Problem 2

A company uses crude oil to fuel the heating system in their factory's plant. The plant's location is remote and the only way to get oil to the plant is by the use of small trucks. Each barrel of oil can hold up to 11 gallons. 1 gallon of oil gets 30 minutes of heating.

How many gallons of oil do we need to heat up the factory for 1 day?

Make a table that shows the number of gallons needed to heat the factory for 1, 2, 3, 4, 5, 6 and 7 days.

Update your table to include also the number of barrels.

Create a formula to determine the number of barrels given the number of days of heating needed.

Use DrRacket's interaction window to calculate and report the answers for 30, 60, 90 and 120 days.

Problem 3

A contractor gets retained by a company to help with customer service. The company pays the contractor 55 dollars a month (he doesn't have to work for that). For every hour he works, he gets $9.75.

How much does the contractor get if he works 2 hours? 5 hours? 10 hours? per month.

Make a table that shows the results.

Create a formula for calculating how much the contractor earns if he works H hours.

Use the formula and the Interactions Window in DrRacket to find out how much the contractor earns when a major event forces him to work for 100, 132, and 141 hours in a single month.

Problem 4

You are asked to develop a currency converter. Customer will provide you with the amount of money in one currency and the exchange rate for the new currency. Based on the exchange rate you have to provide them the amount of money they will receive in the new currency, for example, given 100 US dollars with an exchange rate of 0.77 against the Euro, yields 77 Euros.

Write a "Beginner Student Language" (BSL) function that computes currency conversions when given an amount and the exchange rate.

Use your function to calculate the following conversions:

  1. 150 US dollars with an exchange rate of 0.615 against the British pound
  2. 97 British pounds with an exchange rate of 1.79 against the Australian dollar
  3. 45 Emirati Dirham with an exchange rate of 16.56 against the Indian Rupee