Operating Systems Project
CPSC 250 Lab Aid
CPSC 250 Lab Aid Overview
Create a program to help Students and professors in Computer Science 250.
Allow students to view the results of running the completed source code for lab assignments.
Allow instructors to view and run the source code for a completed lab exercise.
Class Organization
Lab2Classes for Lab2
Lab3Classes for Lab3
Lab4Classes for Lab4
MainFrame2000+ lines of code
GUI and Events
The GUI
Programmed using Net Beans GUI builder.
Will not run in other IDE’s.
The GUI Menu Functions
Contains menu options for Login, Logout, Quit, and About.
All menu functions have shortcut keys.
User Levels
Student/General user does not require a login to use.
Student/General does not allow access to the source code of any lab.
User Levels Cont.
Instructor login must be used to view the source code.
An error or success message is given after user input.
User Levels Cont.
An error message is given when a user tries to view source code without logging in.
A success message is given when a user logs out.
Code Integration
All CPSC 250 labs are designed as Stand-Alone programs.
Code had to be edited to run within the Lab Aid program.
The original code had to be conserved to print in the output window.
A Formatting Nightmare!
A Formatting Nightmare Cont.Problem: How to make the JVM read java code as a series of Strings?
A Formatting Nightmare Cont.Solution: Write a short program in a different language to format the code for you.
In our case, C++ was used.
//a quick utility to read in the contents of a java file
//and convert them into the code necessary toadd them into a
// jTextArea, for use in the main project
// writing to a file was quicker and easier in c++, so it was chosen for this process
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{ifstream Input;
ofstream Output;
Input.open("SizePanel.java"); // file name is changed run by run
Output.open("new SizePanel.java"); // is changed to reflect the change in the above line
string x;
while(!Input.eof())
{
getline(Input, x);
Output<<"jTextArea1.append(\"" + x + "\" + \"\n\" ); "<<endl;
}
Output.close();
Input.close();
return EXIT_SUCCESS;
}
A Formatting Nightmare Cont.
Some problems still existed when trying to format code containing strings.
These were fixed manually by concatenation.
Exception Handling
If errors exist is the source code of a lab, exceptions can occur that can potentially cause the program to crash.
Try/Catch Statements were used to catch any exceptions thrown by faulty code within the labs.
Exception Handling Cont.
An error message is given when an exception is thrown during the execution of a lab.
Finally…
A Demo of the actual program
Credits
This program was created by:
Daniel Goodwin
David Goodell
Devin Saverline