Governor's Career & Technical Academy Arlington

T

CSC 215 Weekly Assignments: Week 16

CSC 215


Overview

In the two weeks we have until Winter break, we will begin a fairly large project which can use to transition from BDS C on CP/M to C++ on Unix.

The random pairs Python choose for this project are:

Caleb and Akshay 
Turner and Trostin
Parker and Luis
Marin and Adonis
Anfal and Johan
Ved and Cody
Issac and Jamethiel
Anar and Jeff

To motivate what we are going to do, I want you to download, compile and run BIGGEST.C and FIXEDPT.C. Then download The Large Integer Case Study in C++. To quote the problem statement on page one of the case study,

Arithmetic operations are fundamental in computing and programming. In many programming environments the largest value of an integer variable is much too small to represent large quantities such as the population of the world, the U.S. national debt, the number of occurrences of the letter 'e' in Melville’s Moby Dick.

This is definitely true in our Altair 8800 BSD C environment. As you can see from running the BIGGEST.C program, the largest signed integer we can store is 32767. That's not even large enough to hold an APS teacher's yearly salary! ;-)

In this project we will use The Large Integer Case Study in C++ as a guide to implement a bigint struct in BSD C.

Week of Monday, December 16th

Goal

Nate Levin responded to my email with both detailed suggestions as to how to port his ctest to BSD C, and a kind offer to help guide the process, so Caleb and Akshay will be working on that, and Anar has been moved to pair with me.

Reading through your study question responses, it is clear that I have not made what we are tying to do explicit enough, so I'll attempt to do that now.

Our goal is to implement an arbitrary-precision integer in BDS C running on CP/M 2.2.

I gave you the College Board's Large Integer Case Study in C++ to use as a guide, but we will need to make significant adjustments and adaptations to the approach taken in that document to accomodate our much more limited computing environment.

In future evaluations, I will be explicitely looking for evidence in what you write that you understand this technical challenge and can reason effectively about it.

Task / Evaluation

Work with your partner to continue reading through the case study document. As you do, try to understand the approach being developed using C++ on a 32 bit machine to solve the problem of creating an arbitrary-precision integer, and evaluate how that approach would have to be modified to work on our 8 bit machines using K&R C.

To help stimulate your thinking and to provide me with evidence that you are getting it, take this sample interaction with our calculator program beginning on the bottom of page 2 of the case study:

Enter value: 5000
--> 5000
Enter operator (+ - * (= to quit)): *
Enter value: 3
--> 15000
Enter operator (+ - * (= to quit)): +
Enter value: 17
--> 15017
Enter operator (+ - * (= to quit)): *
Enter value: 4
--> -5468
Enter operator (+ - * (= to quit)): =

and modify it so that it shows the limits of integer arithmetic in our 8 bit CP/M environment.

Continue to take notes as you read through the case study. Strive to show me by what you write that you are understanding both the problem we are trying to solve and the technical challenges we face to doing it.

Thursday, December 12th

Classwork / Homework / Evaluation

A number of you emailed me about problems with the assignment I gave you (thanks!). Parker figured it out first, and even identified the problem. On page 76 of the BSD C Reference Manual it states:

The following is a section-by-section annotation to the C Reference Manual. For the sake of brevity, some of the items mentioned above will not be pointed out again; any references to floats, longs, statics, initializations, etc., found in the book should be ignored.

On the previous page (75), it states that:

There are no explicitly declarable storage classes. Static and register variables do not exist; all variables are either external or automatic, depending on the context in which they are declared.

After recieving Parker's email, I put our friend José Ejemplo to work on this, and he came up with a work around, DATES.C. We will talk about this in class today.

Next we will get a copy of CALC.C, which implements a BDS C version of the calculator program from Appendix A: The Calculator in The Large Integer Case Study in C++.

Then we will discuss the assignment given last class (when I was out), and decide on a good path forward.

Tasks

Complete each of the following tasks:

  1. Download a copy of The Large Integer Case Study in C++.
  2. Read Introduction, Problem Statement and Description of the Calculator. Create a sub-directory in your git repo named BigInt. Add a markdown file with your responses to the Study Questions.
  3. Download CALC.C, compile it and run it.

These tasks are due by Saturday, December 14th at 11:59 pm so that I can look them over early Sunday morning.

Tuesday, December 10th

Classwork / Homework / Evaluation

The day_of_year and month_day functions are presented on page 104 of The C Programming Language. Study these functions until you understand how they work (i.e. write a small test program to experiment with them).

Then complete Exercise 5-6 on page 110, which asks you to rewrite these functions using pointers instead of indexing.

To earn an A on your next evaluation, commits made both during class and between classes must contain evidence of the effective use of the 3 hours of time you have allotted to work on this, even if you can't complete it. This and the previous assignment are both due tomorrow, Wednesday, December 11 at 1 pm so I have time to evaluate them before we meet on Thursday. If you've been slacking, you need to put in more than 3 hours to make up for what you didn't do last class!