Tuesday, February 21, 2006

Monday, February 20, 2006

This is what the program I previously posted does

This program I finished writing today calculates how much a customer is charged for parking at a parking lot/garage. Each of the following windows pop-up one at a time asking the employee for each specific about the customer's stay.







After the program receives the imputted values about the customer's stay, this last window pops-up and displays the totals including the charge for the stay.

Simple Program in Java

/*This program will calculate the amount charged to a customer at a parking
lot based on vehicle type and length of stay*/

package homework3;

import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import java.io.*;

public class Parking_Lot {
public static void main(String[] args) {
Parking_Lot parking_lot = new Parking_Lot();

char vehicle, C, B, T;//initializes the vehicle types to char
int hourenter = 0, minuteenter = 0, hourleft = 0, minuteleft = 0, totalminutes=0,
totalhours=0, hours=0, minutes=0;//initializes as int
float price=0;//initializes price as a float
double charge=0;//initializes charge as double

String inputString;
inputString = JOptionPane.showInputDialog(null, "Type of Vehicle (C=Car, T=Truck, B=Bus):");
vehicle = inputString.charAt(0);//inputted number assigned to vehicle

inputString = JOptionPane.showInputDialog(null, "Hour vehicle entered lot (0-24):");
hourenter = Integer.parseInt(inputString);//inputted number assigned to hourenter

inputString = JOptionPane.showInputDialog(null, "Minute vehicle entered lot:");
minuteenter = Integer.parseInt(inputString);//inputted number assigned to minuteenter

inputString = JOptionPane.showInputDialog(null, "Hour vehicle left lot (0-24):");
hourleft = Integer.parseInt(inputString);//inputted number assigned to hourleft

inputString = JOptionPane.showInputDialog(null, "Minute vehicle left lot:");
minuteleft = Integer.parseInt(inputString);//inputted number assigned to minuteleft

if(minuteleft//loop makes sure total time is calculated correctly
{
minutes = minuteleft + 60;
hours = hourleft - 1;
}
totalminutes=minuteleft-minuteenter;//calculates the total minutes
totalhours=hourleft-hourenter;//calculates the total hours
if(totalminutes > 0) totalhours++;//rounds up to next hour due to no fractional charges

switch (vehicle)//statement sorts vehicle by letter and calculates charge based on vehicle type
{
case 'C':
{
if(totalhours<=3)//customer not charged if stay is <=3 hours
charge=0;
else
charge=1.50*(totalhours-3);//customer still not charged for first 3 hours,
//but is charged a higher rate for subsequent hours
}
break;
case 'T':
{
if(totalhours<=2)//customer charged special rate if stay is <=2 hours
charge=1.00*totalhours;
else
charge=(1.00*2)+2.30*(totalhours-2);//customer charged special rate for
//first 2 hours, but charged higher rate

//for subsequent hours
}
break;
case 'B':
{
if(totalhours==1)//customer charged special rate if stay is ==1 hour
charge=2.00;
else
charge=2.00+3.70*(totalhours-1);//customer charged special rate for first hour,

//but charged higher rate for subsequent hours
}
break;

default:
JOptionPane.showMessageDialog(null, "Invalid type! Program will terminate.", "Flagrant Error!",
OptionPane.ERROR_MESSAGE);
//error message checks for invalid vehicle types
}
JOptionPane.showMessageDialog(null, "Type of Vehicle: "+vehicle+"\n TIME-IN: "
+hourenter+":"+minuteenter+"\n TIME-OUT: "+hourleft+":"+minuteleft+
"\n Parking Time: "+totalhours+":00\n Total Charge: "+charge+
"","Parking Lot Charges ", JOptionPane.INFORMATION_MESSAGE);
/*above creates window that outputs the vehicle type, hour entered, minute entered,

hour left, minute left, total parking time, and the charge*/
}
}

Saturday, February 18, 2006

New T-Shirts!!


Thursday, February 16, 2006

Top 10 U.N. Slogans

10) If an impotent, bloated bureaucracy can't solve it, then it's best left festering.
9) You can't spell "unethical" without U.N.
8) Genocidal dictators, beware our non-binding resolutions.
7) Bringing peace to our world (actual results may vary).
6) Tomorrow's corruption today.
5) Raising pointless squabbling to an art form.
4) We take bribes so you don't have to.
3) Try our world famous cheesy fries.
2) If troubles abound, we'll be nearby doing nothing.
1) If this is an emergency, please hang up and dial America.

Tuesday, February 14, 2006

Nothing Really to Post About

Nothing really to post about, so here's a post about a post that's really about nothing.

Wednesday, February 08, 2006

Dr. Vladmir Horvat - Engineering Physics Prof (Chechnyan)

this is an audio post - click to play

Promotion Official!

As of last Friday I have officially been promoted from Student Worker III to Student Technician I at the Texas A&M Student Computing Center!! The guy who had the job before graduated last December and they needed someone to take over his position. Basically, what I'll be doing is managing the Video Workstation on the second floor. At the Video Workstation, students and faculty can come in and use the powerful computers to do just about anything you can think of with media. For example, they can transfer VHS to DVD, mini DV's to a DVD, etc. etc. You can also create your own video from scratch, do video editing, and stuff like that. Now my job comes in when people have issues. Most common question: "How do I transfer a VHS to a DVD and create my own title menu like they do on DVD movies?" I've got that down now:D Other than that, my job is to sit there and help people when they have problems doing what they do know how to do and to show people how to do things they don't know how to do (that was a mouthful).

All in all, the promotion comes with a big raise, which is kinda why I accepted it in the first place:D Along with all this comes with one minor annoyance. "Since Justin is the 'Video King', he knows everything about video, right?" Of course!:P (yeah, right). Only problem with that is it tends to carry over to the other aspect of the job: working on the lab floor in general customer service. "Since Justin is the "Video King" he not only must know everything about video, but he must know everything about everything!" Thus, now all the student workers come to me when they have any issues they can't solve. Ironically enough, the raise does come with a price, but I suppose that's what responsibility is all about:)

Tuesday, February 07, 2006

Dr. Fleischner - Calc II Prof (You may need to turn the volume way up)

this is an audio post - click to play