Cover letter
Resume
Skills
References
Work samples
Contact me
|
You have already seen an example of my work by viewing this web page! I created all of the pages contained in this web site
without using a WYSIWYG type editor, but rather with a simple text editor (windows notepad) and knowledge of HTML and Javascript
coding. To view my code for this page (or any web page you visit for that matter), simply click on the VIEW menu at the
top of your browser and then click on SOURCE or PAGE SOURCE.
To view an example of a Javascript program script on my site, use the view source option on the CONTACT ME page.
This page needs embedded programming code to validate the entries on the form and demonstrates the intermingling of program
and HTML code.
Here is a Java code snippet from a simple retail price calculator program I created, followed by a screen shot of the program's execution:
/**
CalcButtonListener is an action listener class for the calculate button.
*/
private class CalcButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
double cost, markup; // These variables will hold the amounts entered in the text fields
double result; // A variable to hold the calculated result
// Get amounts entered in the text fields, convert them from strings to numeric (double) amounts
cost = Double.parseDouble(costTextField.getText());
markup = Double.parseDouble(markupTextField.getText());
result = (cost * (markup / 100)) + cost;
// Display a pop-up window with the result
JOptionPane.showMessageDialog(null, "The retail price of that item is $" + result + ".");
}
}
// The embedded main method to demonstrate the retail calculator class instance window
public static void main(String[] args)
{
RetailCalculator rc = new RetailCalculator();
}
}
Here is a small C++ program that I wrote to calculate and display rainfall information for the user. The program
prompts the user for input and demonstrates programming concepts such as the use of arrays and control structures (selection, repetition).
A screen shot of the program's execution follows the code:
/* C++ chapter 7 programming challenges #2
rainfall.cpp - A program that prompts the user for monthly rainfall totals
and returns commonly needed rainfall results
Author: Brett Rasnick
Date: 5-22-07
*/
#include
#include
using namespace std;
int main()
{
// Declare the variables to be used in the program
const int NUM_MONTHS = 12;
double rainAmounts[NUM_MONTHS]; // an array to hold each month's rainfall totals
double totalYearRain = 0, avgMonthlyRain, highMonth, lowMonth;
int count; // a generic counter for all the loops
// Use a count-controlled FOR loop with prompts for the user to fill the array
for (count = 0; count < NUM_MONTHS; count++)
{
cout << "Enter the rainfall amount for month " << (count + 1) << ": ";
cin >> rainAmounts[count];
if (rainAmounts[count] < 0) // A validation against negative entry amounts
{
cout << "YOU CANNOT ENTER A NEGATIVE AMOUNT!!! PROGRAM WILL NOW TERMINATE. . ." << endl;
system ("pause");
exit(0);
}
}
// Calculate the total rainfall for the year and the average monthly rainfall
for (count = 0; count < NUM_MONTHS; count++)
totalYearRain += rainAmounts[count]; // sum the array
avgMonthlyRain = totalYearRain / NUM_MONTHS; // get the monthly average
// Get the month with the highest rainfall amount
highMonth = rainAmounts[0];
for (count = 1; count < NUM_MONTHS; count++)
{
if (rainAmounts[count] > highMonth)
highMonth = rainAmounts[count];
}
// Get the month with the lowest rainfall amount
lowMonth = rainAmounts[0];
for (count = 1; count < NUM_MONTHS; count++)
{
if (rainAmounts[count] < lowMonth)
lowMonth = rainAmounts[count];
}
// Display the results
cout << endl;
cout << "Thank you!" << endl;
cout << "The total rainfall for the year is " << totalYearRain << " inches." << endl;
cout << "The average monthly rainfall for the year is " << avgMonthlyRain << " inches." << endl;
cout << "The highest monthly amount of rainfall is " << highMonth << " inches." << endl;
cout << "The lowest monthly amount of rainfall is " << lowMonth << " inches." << endl;
system ("pause");
return 0;
}
|