CS 303 Home Page


The syllabus, lab exercises, and other information are posted here.  These are links to Word documents which you should be able to download and print.

cs303syllabus.doc  Syllabus


MyTerminalIO.java  This is the class that supports keyboard I/O in the example programs given below.


These are selected parts of Sun's documentation of Java:

Sun Java Tutorial
Java API Documentation
Main Page for Java Documentation



Section 1, Inheritance


Part A

cs303notesA.doc

            MyTerminalIO.java

            These are links to the example classes in the notes:

            FoodV1.java

            TaxedFoodV1.java

            FoodV2.java

            TaxedFoodV2.java

            FoodV3.java

            TaxedFoodV3.java

cs303assignmentA.doc

cs303oddanswersA.doc

 

The following additional stuff isn't part of CS 303.  Please disregard it.

cs303keyA.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

cs303questionsrandomizedA.doc

cs303questionanswersA.doc


Part B

cs303notesB.doc

            MyTerminalIO.java

            These are links to the examples in the notes:

            Food.java

            PackagedFood.java

            BulkFood.java

            Taxable.java

            TaxedPackagedFood.java

cs303assignmentB.doc

cs303oddanswersB.doc

 

The following additional stuff isn't part of CS 303.  Please disregard it.

cs303keyB.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

cs303questionsrandomizedB.doc

cs303questionanswersB.doc


Part C

cs303notesC.doc

            MyTerminalIO.java

            This is a link to the example in the notes:

            ShippingBox.java

cs303assignmentC.doc

cs303oddanswersC.doc

 

The following additional stuff isn't part of CS 303.  Please disregard it.

cs303keyC.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

cs303questionsrandomizedC.doc

cs303questionanswersC.doc



Section 2, File I/O

RandomFileIOandCollections.doc

RandomFileIOandCollectionsOverheads.doc

    Here are some example programs showing simple character oriented file I/O and RandomAccessFile I/O.

LetterCount.java  This program illustrates simple file I/O.

JavaPaintingArticle.txt  This text file is provided for use with the previous program.

RandomAccessExample.java  This program illustrates the use of random access files.  It may serve as a useful starting point for doing the assignment.

RandomAccessMethods.java  This class contains some methods used in the preceding program file.  This approach might be useful in doing the programming assignment.

RandomAccessModified.java  This program is a further development of the random access file example.  It would correspond to part of the assignment.  It is not available for general viewing.


    File I/O assignment.  Here are three individual assignment files, D, E, and F.  The assignment can be satisfied with a single piece of code which includes everything specified in these three files.  The idea behind the three files is that it would be logical to solve the complete problem in three steps that build on each other.

cs303assignmentD.doc

cs303assignmentE.doc
cs303assignmentF.doc




Section 3, UML

UMLwithVisioinfo.doc  This contains information on simple UML diagrams along with guidelines on how to make such diagrams in Microsoft Visio.  You will need to make use of this when doing the assignments which follow.  The two following links are to abbreviated versions of this file.

UMLOverheads.doc

UMLOverheadsWithVisio.doc  This file has the contents of the overheads with the Visio information inserted into it.  It will not be shown as overheads.  It is just given for your reference.

cs303assignmentG.doc



Section 4, Wari and Togiz Kumalak


TogizKumalakAssignments.doc

    Here are the documents for assignment 1.

wari.doc  This document contains some background information on, and the rules for the game of Wari.

togizkumalak.doc  This document contains some background information on, and the rules for the game of Togiz Kumalak.

cs303assignment1.doc  This is assignment 1.

MyTerminalIO.java  This is the class that supports keyboard I/O in the following example program.

WariV1.java  This is example code giving an idea of what you might write if the assignment were to implement Wari instead of Togiz Kumalak.  In fact, the implementation of the full set of rules for Wari as explained in wari.doc is not easy.  For what it's worth, this and all following examples based on Wari implement a simplified set of game rules.


    Here are the documents for assignment 2.

cs303assignment2.doc  This is assignment 2.

    The following set of files constitute an object oriented implementation of Wari.  They are not given as ideal examples of code, but as illustrations of what is possible.

    WariV21.java:  In this implementation the game board and the cups have been broken out into separate classes.  The board class implementation is a hybrid.  In the non-object-oriented version of the code an array of cups formed the board.  In this implementation the cups of the board are still contained in an array.  However, these cups have links so that they can be traversed by following the links rather than by incrementing the array indexes.  It would be possible to do an object-oriented implementation without the array.  This example shows the reality of how one implementation can be the basis of another.  It does not hide the fact that such a development process may leave traces in the resulting code.

WariV21.java

BoardV21.java

CupV21.java

    WariV22.java:  There is a difference between the cups on the board where play progresses and the cups where players' winnings are stored.  The cups where play progresses are linked to each other.  The winnings cups do not need to be linked to anything else.  In this implementation there is a plain cup class, and the winnings cups are instances of this class.  There is also a linked cup class, which is a subclass of the plain cup class.  The cups where play progresses are instances of the linked cup class.  As seen from version 21, it is not necessary to do this in order to have a correct implementation.  Version 22 is simply intended to provide a concrete illustration of a small inheritance hierarchy. 

WariV22.java

BoardV22.java

CupV22.java

LinkedCupV22.java


InterfaceOutlinePart1.doc  This document contains all of the introductory comments for the Echo and Click example programs below.  The comments exist at the top of the file and they are also given right here on the Web page next to the link.  In case it is of any use, they are given all together in this document.



MyContainerComponentAndPaintingNotes.doc  This links to a document that surveys the topics of containers, components, and painting, which start coming up in the following examples.


    Here are the documents for assignment 3.

cs303assignment3.doc  This is assignment 3.

    Relevant examples:

Echo1.java  GUI Example 1. This program shows the use of the system supplied input dialog box. Output is done through a MyTerminalIO object.  Since the input methods of MyTerminalIO make use of dialog boxes,
the user interface presented by the program when running does not differ from the interface that would be presented by a program that only made use of MyTerminalIO.

    When using the dialog boxes, no object is created. A static method is called on the system supplied JOptionPane class. The showInputDialog() method always brings in a String, so if a numeric type is expected it
is necessary to parse the String.

    The call to exit(0) is not related to the use of the dialog boxes.  It is included to illustrate coding an explicit end to a program. When using exit() in this way, the final prompt, "Enter anything to quit." is necessary in order to keep the MyTerminalIO object, containing the output, in existence. As soon as exit() is called, all objects connected with the program go away.

Echo2.java  GUI Example 2. This program shows how to do String output into a panel belonging to a frame in an application. It follows in the sequence of Echo programs, but the name Echo2 is not entirely accurate. The program does not do any input and does not echo. Several new things have to be taken care of in order to do output in the way shown. Nothing else is covered in the program so that the treatment of output is as clear as
possible.

Echo2StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo2UML.doc  Here is a simple UML diagram for this program drawn by hand.

Echo3.java  GUI Example 3. This program combines the dialog box of example 1 with the panel output of example 2 to make a graphical echoing program that doesn't rely on MyTerminalIO. The program loops in order to continue accepting input. A couple of methods are needed in order to set the value of the input string, which belongs to the panel.

Echo3StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo3UML.doc  Here is a simple UML diagram for this program drawn by hand.

    Relevant versions of Wari:  None.



    Here are the documents for assignment 4.

InnerClassNotation.doc

cs303assignment4.doc  This is assignment 4.

    Relevant examples:

Echo4.java  GUI Example 4.  This program does not do anything.  The code illustrates in as simple a form as possible the syntax for an inner class.  It also shows that the inner class has direct access to the instance variables of the outer class.  This access is what makes inner classes useful.  Inner classes will be used in coming examples to integrate graphical input into an application.

Echo5.java  GUI Example 5.  This program does echoing with an integrated text field and listener for input and a panel for output.  It takes a String input and echoes that String.  The String belongs to the Frame and the listener and the panel are inner classes of the Frame.  This gives both of them direct access to the String.  The listener can set the value of the instance variable and the panel can get the value in order to display it.

Echo5StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo5UML.doc  Here is a simple UML diagram for this program drawn by hand.

Echo6.java  GUI Example 6.  This echoing program changes the last one by not having the panel be an inner class.  This design is more generalizable.  The string is part of the panel rather than part of the frame.  The listener has direct access to the frame's panel.  The listener doesn't have direct access to the panel's instance variables, so the panel class needs a set method for the string.

Echo6StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo6UML.doc  Here is a simple UML diagram for this program drawn by hand.

    Relevant versions of Wari:

WariV31.java:  This version of Wari includes a text box for input.  It does simple ASCII output, but in a graphic frame.  The most important thing to notice is that the application itself has no loop in it.  Java's management of events, namely the event of entering input, controls the logic of the application.

WariV31.java

BoardV31.java

BoardLineV31.java

CupV31.java

WariV32.java:  This version of Wari handles the production of output somewhat differently than the previous version.  The graphics object is passed as a parameter.  This may or may not be a better solution.  Later, when the application becomes more completely graphical, the handling of ASCII text strings in output will be considerably less important anyway.

WariV32.java

BoardV32.java

CupV32.java


    Here are the documents for assignment 5.

cs303assignment5.doc  This is assignment 5.

    Relevant examples:

Echo7.java  GUI Example 7.  This program involves several changes from Echo6.  It gives the input text field a width.  Unfortunately, the width does not correspond to the number of characters of the default font that are displayed in the field.  The application provides default text in the field.  The field is also put into its own panel.  If this is not done, the field is displayed as if it has not been given a size.  A WindowCloser is added to the program so that it will end when its frame is closed.  This is implemented as an inner class.  The WindowCloser also illustrates the use of Adapter classes, which will be useful for other GUI elements in future examples.

Echo7StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo7UML.doc  Here is a simple UML diagram for this program drawn by hand.

Echo7SequenceVisio.vsd  Here is a simple UML sequence diagram for this program done in MS Visio.

Echo7SeqDia.doc  Here is a simple sequence diagram for part of this program drawn by hand.

Echo8.java  GUI Example 8.  This program illustrates the use of an anonymous inner class.  For cases where a single instance of a class is made and there is no reason for the class to have a name, some programmers may find it convenient.  In more complicated examples than this one other syntactic details may be involved.  By definition, anonymous classes are rather cryptic.  Using this syntax is optional.  It will not be used in further example programs, but programmers should be aware of its existence in case they encounter it.

Echo9.java  GUI Example 9.  This program introduces a cup class.  A cup contains a seed count and it also has attributes that describe it as a rectangle and give its x and y coordinates in the frame.  The application now accepts only an integer value in the text field.  This is used to set the seed count of the cup.  The cup class has a drawCup() method which causes the rectangle representing the cup and its seed count to be displayed.  The drawCup() method takes the Graphics2D object g2 as a parameter in order to have access to the panel for drawing.  This program echoes a value and displays simple graphical attributes associated with the objects in the application.

Echo9StructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

Echo9UML.doc  Here is a simple UML diagram for this program drawn by hand.

Echo9Sequence1Visio.vsd  Here is a simple UML sequence diagram for part of this program done in MS Visio.

Echo9SeqDia1.doc  Here is a simple sequence diagram for part of this program drawn by hand.

Echo9Sequence2Visio.vsd  Here is a simple UML sequence diagram for part of this program done in MS Visio.

Echo9SeqDia2.doc  Here is a simple sequence diagram for part of this program drawn by hand.

    Relevant versions of Wari:

WariV4.java:  In this version of Wari, the cups on the board are now represented by graphical rectangles rather than ASCII dividers.  However, the seeds are still represented by numeric counts.  Input is still handled by a text box.

WariV4.java

BoardV4.java

CupV4.java


    Here are the documents for assignment 6.  For the assignment itself, see the information on the group consisting of 6, 7, and 8, following the documents for assignment 8.

    Relevant examples:

ClickCup.java  GUI Example 10.  This program now has 2 cups in the panel.  Clicking one cup moves its contents to the other.  The panel class has a new variable, whichCupIsActive.  The logic of the program is contained in a MouseAdapter which checks to see whether a mouse click has occurred in a cup and whether that cup is active.  Some of the functionality of this example could be accomplished using JButtons, but making object representations clickable is a more general solution.

ClickCupStructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

ClickCupUML.doc  Here is a simple UML diagram for this program drawn by hand.

    Relevant versions of Wari:

WariV5.java:  In this version of Wari input is no longer handled by a textbox.  Instead, the rectangles representing the cups on the board have been turned into clickable regions.  The seeds are still represented by numeric counts.

WariV5.java

BoardV5.java

CupV5.java



    Here are the documents for assignment 7.  For the assignment itself, see the information on the group consisting of 6, 7, and 8, following the documents for assignment 8.

    Relevant examples:

ClickDot.java  GUI Example 11.  This program contains a new class, Seed.  The cups hold seeds, which are displayed as dots on the screen.  Instead of having a simple integer count of the number of seeds in a cup, the seed objects are maintained in ArrayLists which are instance variables of the cups.  Clicking on a cup causes the seeds to jump from that cup to the other, and also causes the representation on the screen to reflect that change.  Seeds do not have fixed locations, so they don't have any instance variables which define their location.  Their graphical representation, which is called a dot, is constructed when needed in displaying the state of the program.  This is in contrast to the Cup class, which has the instance variable cupRectangle.  In both cases it is important to understand that the object and its representation are not identical.  This is probably clearer in the Seed class.

ClickDotStructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

ClickDotUML.doc  Here is a simple UML diagram for this program drawn by hand.

    Relevant versions of Wari:  None.


    Here are the documents for assignment 8.  For the assignment itself, see the information on the group consisting of 6, 7, and 8, following this section.

    Relevant examples:

ClickHand.java  GUI Example 12.  This program shows a different mouse pointer, the hand, over whichever cup is active at a given time.  This involves a new listener, a mouse motion listener, which belongs to the panel.

ClickHandStructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

ClickHandUML.doc  Here is a simple UML diagram for this program drawn by hand.

Relevant versions of Wari:

WariV6.java:  In this version of Wari the seeds are represented by dots rather than numeric counts.  The Cup6 class uses an ArrayList to hold the seeds and it uses for each logic to iterate over the seeds in one method.

WariV6.java

BoardV6.java

CupV6.java

SeedV6.java

WariV7.java:  In this version of Wari, the mouse pointer changes shape depending on what part of the board it is over.  In particular, it indicates when it is over the side of the board that is currently clickable and when it is not.  The Cup7 class uses an ArrayList to hold the seeds and it uses for each logic to iterate over the seeds in one method.

WariV7.java

BoardV7.java

CupV7.java

SeedV7.java

WariV8.java:  This final version of Wari contains another ArrayList.  Not only are the seeds in the Cup8 class contained in an ArrayList, but the BoardV8 class uses an iterator in one method in order to iterate over the seeds in a clone of the cup, the hand full being played, which holds seeds in an ArrayList.

WariV8.java

BoardV8.java

CupV8.java

SeedV8.java


    Group 6, 7, 8 assignment.  Here are three individual assignment files.  The assignment can be satisfied with a single piece of code which includes everything specified in these three files.  The idea behind the three files is that it would be logical to solve the complete problem in three steps that build on each other.

cs303assignment6.doc  This is assignment 6.

cs303assignment7.doc  This is assignment 7.

cs303assignment8.doc  This is assignment 8.

 



    Here are the documents for assignment 9.

cs303assignment9.doc  This is assignment 9.

cs303assignment9background.doc  This document provides background information that should be useful in doing the assignment.

    Stuff related to putting an applet in a Web page:

ClickHandApplet.html  This is the link to how the applet should come up in the browser.

ClickHandBefore.java  This shows the application code before being turned into an applet.

ClickHandAfter.java  This shows the code after being turned into an applet.

    Stuff related to self-executable .jar files:

ClickHand.jar  This is such a .jar file.

    Relevant versions of Wari:  None.



    Here are the documents for assignment 10.  For the assignment itself, see the information on the group consisting of 10, 11, and 12, following the documents for assignment 12.

    Relevant examples:

ClickKey.java  GUI Example 13.  This program illustrates the idea that you can use keyboard input as well as mouse clicks to in order to cause actions to be taken.

    Relevant versions of Wari:  None.


    Here are the documents for assignment 11.  For the assignment itself, see the information on the group consisting of 10, 11, and 12, following the documents for assignment 12.

    Relevant examples:

ClickMenu.java  GUI Example 14.  This program includes a simple menu with two options.  One causes the program to exit, which duplicates the functionality of the WindowCloser.  The other causes the application to restart, or reset itself to its initial state.  The menu and the listeners for the two options belong to the frame.  The second option relies on a new method in the panel.

ClickMenuStructureVisio.vsd  Here is a simple UML structure diagram for this program done in MS Visio.

ClickMenuUML.doc  Here is a simple UML diagram for this program drawn by hand.

    Relevant versions of Wari:  None.


    Here are the documents for assignment 12.  For the assignment itself, see the information on the group consisting of 10, 11, and 12, following this section.

    Relevant examples:

ClickMany.java  GUI Example 15.  This program makes it possible to open up more than one frame with cups in it.  The menu for the main frame allows you to open up the new frames or quit the application overall.  The menus on the sub frames allow you to restart or quit that frame.

    Relevant versions of Wari:  None.


    Group 10, 11, 12 assignment.  Here are three individual assignment files.  The assignment can be satisfied with a single piece of code which includes everything specified in these three files.  The idea behind the three files is that it would be logical to solve the complete problem in three steps that build on each other.

cs303assignment10.doc  This is assignment 10.

cs303assignment11.doc  This is assignment 11.

cs303assignment12.doc  This is assignment 12.

 



    Here are the documents for assignment 13.  For the assignment itself, see the information on the group consisting of 13, 14, and 15, following the documents for assignment 15.

    Relevant examples:

ClickSave.java  GUI Example 16.  This program adds two menu options, one to save the current state of the cups in the application, and the other to reload them.  Adding the menu items means adding a listener for each.  Both of these options just bring up dialog boxes instead of file choosers. 

Saving objects is based on something called serialization.  To be serializable a class has to implement the Serializable interface.  In this program it is the SeedCup and the Seed classes which contain the actual state of the application, so they are made serializable.  The SeedCup class contains a Rectangle.  The SeedCup class is serializable because the Rectangle class is serializable.  The Seed class does not contain an Ellipse2D.  This is significant, because none of the system supplied ellipse classes is serializable.  If the Seed class did contain such an instance variable, it would not be serializable.

    Relevant versions of Wari:  None.


    Here are the documents for assignment 14.  For the assignment itself, see the information on the group consisting of 13, 14, and 15, following the documents for assignment 15.

    Relevant examples:

ClickChooser.java  GUI Example 17.  This program shows the use of the JFileChooser in order to make saving and opening files more convenient.


    Here are the documents for assignment 15.  For the assignment itself, see the information on the group consisting of 13, 14, and 15, following this section.

    Relevant examples:

ClickTextScroll.java  GUI Example 18.  This program uses a JTextArea and a JScrollPane to include a textual record of the sequence of actions in the application.  Although JTextArea implements the Serializable interface, saving application information by saving the JTextArea containing it is not the best solution.  In this example the save and load options have been removed rather than making the application more complex by implementing a more general approach to saving.  The ClickTextScrollPanel has a JTextArea instance variable, actionRecordArea.  This instance variable is constructed where it is declared, rather than in the body of the constructor for the panel.  When constructed in the body, a run time error would occur, where a reference to the JTextArea in the MouseHandler would come up null.


    Group 13, 14, 15 assignment.  Here are three individual assignment files.  The assignment can be satisfied with a single piece of code which includes everything specified in these three files.  The idea behind the three files is that it would be logical to solve the complete problem in three steps that build on each other.

cs303assignment13.doc  This is assignment 13.

cs303assignment14.doc  This is assignment 14.

cs303assignment15.doc  This is assignment 15.

 



Section 5, MISC

InterfaceOutlinePart2.doc  This document contains all of the introductory comments for the Misc example programs below.  The comments exist at the top of the file and they are also given right here on the Web page next to the link.  In case it is of any use, they are given all together in this document.  These blocks of examples don't have assignments individually associated with them.  Taken together, they provide background for the final project, which is posted after them.


MiscButton1.java  GUI Example 19.  This program illustrates using a button to trigger action, not a clickable cup.  The contents of the cup have been changed back to text because the following examples will move towards registers containing strings of characters rather than cups containing seeds.

MiscButtonUML.doc


MiscButton2.java  GUI Example 20.  This version of the application moves the button to the bottom of the panel.  The shortcoming of the way it's done is that the button is as wide as the whole panel.

MiscButton2UML.doc


MiscButton3.java  GUI Example 21.  This version of the application creates another panel so that the button can be moved to the bottom of the panel and displayed in a pleasanter way.  In general, creating nested panels is a simple approach to getting things laid out in a nice way.

MiscButton3UML.doc


MisRegisterOneFile.java  GUI Example 22.  This version of the application switches from cups to registers containing strings of characters representing binary digits.  The code implements a swap of register contents so the idea of which register is active does not apply.  The logic to support this, which existed in the cup examples, does not exist in this example.

Program files given separately.

MiscRegister.java

MiscRegisterRegister.java

MiscRegisterByte.java

MiscRegisterUML.doc


MiscTextOneFile.java  GUI Example 23.  In this program each register is represented by a text field.  The text fields have their own listeners, so it is possible to enter new values into the registers.  There is also a button with a listener.  The button functions to swap the values between the registers.

        From this point on in the examples, the components of the applications are not objects of classes like Cup, which are written from scratch.  The components are system supplied, and the system takes care of repainting them when necessary.  In this example calls to repaint() are included where they might be expected, but they are commented out.  The run time appearance of the application is the same when they are not commented out.

Program files given separately.

MiscText.java

MiscTextRegister.java

MiscTextByte.java

MiscTextUML.doc


MiscLabelOneFile.java  GUI Example 24.  This program includes labels on the text fields.  It also puts each visual component into its own panel and then arranges those subpanels in a grid layout in the MiscLabelPanel in order to get a desirable appearance for the application.

Program files given separately.

MiscLabel.java

MiscLabelRegister.java

MiscLabelByte.java

MiscLabelUML.doc


MyFocusNotes.java  This file provides some general background on the topic of focus.

MiscFocusOneFile.java  GUI Example 25.  This program shows a little bit about handling focus.  When a new value is entered in one of the text fields the cursor moves to the other text field.  Each register has an instance variable holding a reference to the component which should receive the focus after it.  This instance variable is set to the other register when each register is being constructed.  The code which passes the focus is in the text field listener.

Program files given separately.

MiscFocus.java

MiscFocusRegister.java

MiscFocusByte.java


MiscActionOneFile.java  GUI Example 26.  This program shows how to set up an action so that the key combination CTRL+S has the same effect as clicking the Swap button.  This is done by creating an action object and attaching it to both the button and the keystroke sequence.  It is only necessary to make changes in the panel class in order to accomplish this.

Program files given separately.

MiscAction.java

MiscActionRegister.java

MiscActionByte.java


MiscMultiOneFile.java  GUI Example 27.  This program illustrates the idea of multicasting.  In the previous example more than one event, a button click or a keystroke, could trigger the same listener.  In this example each text field has its own listener which listens for a single event, the clicking of the clear button.  Having the same event trigger multiple listeners is referred to as multicasting.

Program files given separately.

MiscMulti.java

MiscMultiRegister.java

MiscMultiByte.java


MiscMemoryOneFile.java  GUI Example 28.  This program illustrates the implementation of machine memory using a class, and representing it visually using a text area with scroll bars.  The functionality of loading a file into the memory is implemented through a menu option.  The code for the listener which does the loading is adapted from the runProgramFile() method in MISC.  There is no explicit handling of focus in this example.  The automatic traversal of components using the tab key is in effect.  However, once you enter the text area, all keystrokes are interpreted as text, not as commands.

Program files given separately.

MiscMemory.java

MiscMemoryMemory.java

MiscMemoryWord.java

MiscMemoryByte.java


MiscRegAndMemOneFile.java  GUI Example 29.  This program puts together registers and memory.  Clicking the swap button causes the values in the registers to be swapped and also causes the value in register A to be placed in offset 0 of memory.

Program files given separately.

MiscRegAndMem.java

MiscRegAndMemMemory.java

MiscRegAndMemRegister.java

MiscRegAndMemWord.java

MiscRegAndMemByte.java


MiscThreadOneFile.java  GUI Example 30. This example shows how multiple frames can be added to the running application where each frame has its own thread of execution. In order to show that the threads run concurrently the contents of the registers are swapped back and forth repeatedly.  A sleep() call is put in the run() method in order to slow the swapping down enough that it is easy to see.

Program files given separately.

MiscThread.java

MiscThreadRegister.java

MiscThreadByte.java



cs303finprojass.doc  This is the final project assignment.


    Here are the documents relevant to the final project assignment.

    These files provide verbal documentation of the MISC machine simulation.  MISC is the basis for the project assignment.  This background may be helpful for understanding the Java source code files below.

miscinfojavaV1.doc  This is the main documentation file for the MISC machine simulation.

miscinfojavaV1overheads.doc  This is an additional documentation file for MISC, giving details on how arithmetic is handled inside the simulation.


    Here is a set of files provided by a student.  The program PR is a program reader.  It reads a machine language program like sumtenV3.txt or sumtenbadV3.txt and produces an assembly language-like translation of it.  This might be a useful tool for you when trying to figure out what MISC is and how it works. The student wrote this when working on assignment 3 for CS 320.  That's why the files are marked V3.  To make sure that there are no hidden inconsistencies between versions, the complete set of files provided by the student is given. 

    PR.jar

    PR.java

    ProgReader.java

    MachineWordV3.java

    MachineByteV3.java

    MyTerminalIO.java

    sumtenV3.txt

    sumtenbadV3.txt


    This is a link to the Web documentation for the MISC simulation.

V1index.html  This is the entry point into the Web documentation for version 1 of the MISC simulation.

    The following are the source files for MISC version 1.  They are the starting point for the code you will write for the project assignment.

MachineByteV1.java

MachineWordV1.java

MachineV1.java

MachineOSProgramV1.java

OsystemV1.java

MyTerminalIO.java

    This is a link to the machine language source code file that should run on version 1 of MISC.

sumtenV1.txt





THE END