Tuesday, February 21, 2006
Monday, February 20, 2006
This is what the program I previously posted does
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();
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
{
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
Thursday, February 16, 2006
Top 10 U.N. Slogans
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
Wednesday, February 08, 2006
Promotion Official!
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:)