The Sims Gallon Converters

The Sims Gallon Converters are a series of web toys stylized around Sims games, and released online as web toys. They convert gallon amounts to quarts and liters.

Original build
The original build was a Sims 2-themed converter, which was made around 5:00 PM EST on January 22nd of 2006. It was initially a part of an assignment at Lansing Community College, for the class "CITP 150," taken in the spring semester of 2006 under instructor Mave Coxon. One of the first assignments involved making an easy converter app of a value in gallons to a value in quarts and liters, taken from adapting a similar QBasic assignment in an earlier class. Going a step beyond, the founder of Dozerfleet decided to try fancy skinning graphics for the app - theming it after The Sims 2. Exported to an EXE file, the program was demonstrated in class the following Monday morning, the 23rd.

Web ports
In keeping with The Sims 4 being released, a second version of the converter was made, this time as an HTML / CSS form. Its Sims 4 remix soon followed. The final result was released around 11:57 PM EDT on October 15th of 2014. A re-release of the converters to the Dozerfleet Labs official blog occurred around September 6th of 2020.

In VB.NET
Scripting instructions were different, as can be expected when made in different languages. The VB.NET version's source code looked like this:

Option Strict Off Option Explicit On

Public Class TS2GalCalcForm Inherits System.Windows.Forms.Form


 * 1) Region " Windows Form Designer generated code "

Public Sub New MyBase.New

'This call is required by the Windows Form Designer. InitializeComponent

'Add any initialization after the InitializeComponent call

End Sub

'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose End If       End If        MyBase.Dispose(disposing) End Sub

'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents calculateButton As System.Windows.Forms.PictureBox Friend WithEvents command2Button As System.Windows.Forms.PictureBox Friend WithEvents closeButton As System.Windows.Forms.PictureBox Friend WithEvents gcLabel As System.Windows.Forms.Label Friend WithEvents litersLabel As System.Windows.Forms.Label Friend WithEvents liter2Label As System.Windows.Forms.Label Friend WithEvents quartsLabel As System.Windows.Forms.Label Friend WithEvents quarts2Label As System.Windows.Forms.Label Friend WithEvents gallons2Label As System.Windows.Forms.Label Friend WithEvents gallonsTextBox As System.Windows.Forms.TextBox Friend WithEvents descriptionLabel As System.Windows.Forms.Label Friend WithEvents close2Label As System.Windows.Forms.Label Friend WithEvents clearButton As System.Windows.Forms.PictureBox Friend WithEvents clear2Label As System.Windows.Forms.Label Friend WithEvents Panel1 As System.Windows.Forms.Panel  Private Sub InitializeComponent Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(TS2GalCalcForm)) Me.calculateButton = New System.Windows.Forms.PictureBox Me.command2Button = New System.Windows.Forms.PictureBox Me.closeButton = New System.Windows.Forms.PictureBox Me.close2Label = New System.Windows.Forms.Label Me.gcLabel = New System.Windows.Forms.Label Me.litersLabel = New System.Windows.Forms.Label Me.liter2Label = New System.Windows.Forms.Label Me.quartsLabel = New System.Windows.Forms.Label Me.quarts2Label = New System.Windows.Forms.Label Me.gallons2Label = New System.Windows.Forms.Label Me.gallonsTextBox = New System.Windows.Forms.TextBox Me.descriptionLabel = New System.Windows.Forms.Label Me.clearButton = New System.Windows.Forms.PictureBox Me.clear2Label = New System.Windows.Forms.Label Me.Panel1 = New System.Windows.Forms.Panel Me.SuspendLayout '       'calculateButton '       Me.calculateButton.BackColor = System.Drawing.Color.Transparent Me.calculateButton.Image = CType(resources.GetObject("calculateButton.Image"), System.Drawing.Image) Me.calculateButton.Location = New System.Drawing.Point(126, 37) Me.calculateButton.Name = "calculateButton" Me.calculateButton.Size = New System.Drawing.Size(76, 107) Me.calculateButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.calculateButton.TabIndex = 0 Me.calculateButton.TabStop = False '       'command2Button '       Me.command2Button.BackColor = System.Drawing.Color.Transparent Me.command2Button.Image = CType(resources.GetObject("command2Button.Image"), System.Drawing.Image) Me.command2Button.Location = New System.Drawing.Point(14, 37) Me.command2Button.Name = "command2Button" Me.command2Button.Size = New System.Drawing.Size(96, 85) Me.command2Button.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.command2Button.TabIndex = 1 Me.command2Button.TabStop = False '       'closeButton '       Me.closeButton.BackColor = System.Drawing.Color.Transparent Me.closeButton.Image = CType(resources.GetObject("closeButton.Image"), System.Drawing.Image) Me.closeButton.Location = New System.Drawing.Point(316, 130) Me.closeButton.Name = "closeButton" Me.closeButton.Size = New System.Drawing.Size(31, 38) Me.closeButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.closeButton.TabIndex = 2 Me.closeButton.TabStop = False '       'close2Label '       Me.close2Label.BackColor = System.Drawing.Color.Transparent Me.close2Label.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.close2Label.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.close2Label.Location = New System.Drawing.Point(347, 144) Me.close2Label.Name = "close2Label" Me.close2Label.Size = New System.Drawing.Size(34, 18) Me.close2Label.TabIndex = 3 Me.close2Label.Text = "Exit" Me.close2Label.TextAlign = System.Drawing.ContentAlignment.MiddleRight '       'gcLabel '       Me.gcLabel.BackColor = System.Drawing.Color.Transparent Me.gcLabel.Font = New System.Drawing.Font("Comic Sans MS", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.gcLabel.ForeColor = System.Drawing.Color.White Me.gcLabel.Location = New System.Drawing.Point(7, 123) Me.gcLabel.Name = "gcLabel" Me.gcLabel.Size = New System.Drawing.Size(109, 35) Me.gcLabel.TabIndex = 4 Me.gcLabel.Text = "Gallon Converter" Me.gcLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter '       'litersLabel '       Me.litersLabel.BackColor = System.Drawing.Color.Transparent Me.litersLabel.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.litersLabel.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.litersLabel.Location = New System.Drawing.Point(219, 100) Me.litersLabel.Name = "litersLabel" Me.litersLabel.Size = New System.Drawing.Size(117, 22) Me.litersLabel.TabIndex = 5 Me.litersLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight '       'liter2Label '       Me.liter2Label.BackColor = System.Drawing.Color.Transparent Me.liter2Label.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.liter2Label.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.liter2Label.Location = New System.Drawing.Point(275, 100) Me.liter2Label.Name = "liter2Label" Me.liter2Label.Size = New System.Drawing.Size(117, 22) Me.liter2Label.TabIndex = 6 Me.liter2Label.Text = "Liters" Me.liter2Label.TextAlign = System.Drawing.ContentAlignment.BottomRight '       'quartsLabel '       Me.quartsLabel.BackColor = System.Drawing.Color.Transparent Me.quartsLabel.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.quartsLabel.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.quartsLabel.Location = New System.Drawing.Point(219, 69) Me.quartsLabel.Name = "quartsLabel" Me.quartsLabel.Size = New System.Drawing.Size(117, 22) Me.quartsLabel.TabIndex = 7 Me.quartsLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight '       'quarts2Label '       Me.quarts2Label.BackColor = System.Drawing.Color.Transparent Me.quarts2Label.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.quarts2Label.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.quarts2Label.Location = New System.Drawing.Point(281, 69) Me.quarts2Label.Name = "quarts2Label" Me.quarts2Label.Size = New System.Drawing.Size(117, 22) Me.quarts2Label.TabIndex = 8 Me.quarts2Label.Text = "Quarts" Me.quarts2Label.TextAlign = System.Drawing.ContentAlignment.BottomRight '       'gallons2Label '       Me.gallons2Label.BackColor = System.Drawing.Color.Transparent Me.gallons2Label.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.gallons2Label.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.gallons2Label.Location = New System.Drawing.Point(281, 38) Me.gallons2Label.Name = "gallons2Label" Me.gallons2Label.Size = New System.Drawing.Size(117, 19) Me.gallons2Label.TabIndex = 10 Me.gallons2Label.Text = "Gallons" Me.gallons2Label.TextAlign = System.Drawing.ContentAlignment.BottomRight '       'gallonsTextBox '       Me.gallonsTextBox.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.gallonsTextBox.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.gallonsTextBox.ForeColor = System.Drawing.Color.FromArgb(CType(86, Byte), CType(95, Byte), CType(155, Byte)) Me.gallonsTextBox.Location = New System.Drawing.Point(219, 35) Me.gallonsTextBox.Name = "gallonsTextBox" Me.gallonsTextBox.Size = New System.Drawing.Size(124, 26) Me.gallonsTextBox.TabIndex = 11 Me.gallonsTextBox.Text = "" Me.gallonsTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right '       'descriptionLabel '       Me.descriptionLabel.BackColor = System.Drawing.Color.Transparent Me.descriptionLabel.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.descriptionLabel.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.descriptionLabel.Location = New System.Drawing.Point(35, 9) Me.descriptionLabel.Name = "descriptionLabel" Me.descriptionLabel.Size = New System.Drawing.Size(341, 19) Me.descriptionLabel.TabIndex = 12 Me.descriptionLabel.Text = "Enter Gallons amount then click on Sim to convert." Me.descriptionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter '       'clearButton '       Me.clearButton.BackColor = System.Drawing.Color.Transparent Me.clearButton.Image = CType(resources.GetObject("clearButton.Image"), System.Drawing.Image) Me.clearButton.Location = New System.Drawing.Point(224, 132) Me.clearButton.Name = "clearButton" Me.clearButton.Size = New System.Drawing.Size(31, 35) Me.clearButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.clearButton.TabIndex = 13 Me.clearButton.TabStop = False '       'clear2Label '       Me.clear2Label.BackColor = System.Drawing.Color.Transparent Me.clear2Label.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.clear2Label.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.clear2Label.Location = New System.Drawing.Point(256, 145) Me.clear2Label.Name = "clear2Label" Me.clear2Label.Size = New System.Drawing.Size(56, 18) Me.clear2Label.TabIndex = 14 Me.clear2Label.Text = "Refresh" Me.clear2Label.TextAlign = System.Drawing.ContentAlignment.MiddleRight '       'Panel1 '       Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.Panel1.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.Panel1.Location = New System.Drawing.Point(120, 33) Me.Panel1.Name = "Panel1" Me.Panel1.Size = New System.Drawing.Size(88, 116) Me.Panel1.TabIndex = 15 '       'TS2GalCalcForm '       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.Color.FromArgb(CType(86, Byte), CType(95, Byte), CType(155, Byte)) Me.ClientSize = New System.Drawing.Size(405, 174) Me.Controls.Add(Me.clear2Label) Me.Controls.Add(Me.clearButton) Me.Controls.Add(Me.descriptionLabel) Me.Controls.Add(Me.gallonsTextBox) Me.Controls.Add(Me.gallons2Label) Me.Controls.Add(Me.quartsLabel) Me.Controls.Add(Me.quarts2Label) Me.Controls.Add(Me.litersLabel) Me.Controls.Add(Me.liter2Label) Me.Controls.Add(Me.calculateButton) Me.Controls.Add(Me.gcLabel) Me.Controls.Add(Me.close2Label) Me.Controls.Add(Me.closeButton) Me.Controls.Add(Me.Panel1) Me.Controls.Add(Me.command2Button) Me.ForeColor = System.Drawing.Color.FromArgb(CType(137, Byte), CType(153, Byte), CType(219, Byte)) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.Name = "TS2GalCalcForm" Me.Opacity = 0.95 Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "The Sims 2 Gallon Converter" Me.ResumeLayout(False)

End Sub


 * 1) End Region

Private Sub closeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton.Click 'Alternate Way to Exit the Program

Me.Close

End Sub

Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click On Error GoTo ErrorHandler Dim gallonsSingle As Single Dim quartsSingle As Single Dim litersSingle As Single

gallonsSingle = Single.Parse(gallonsTextBox.Text) quartsSingle = 4 * gallonsSingle litersSingle = 3.785 * gallonsSingle

quartsLabel.Text = quartsSingle.ToString litersLabel.Text = litersSingle.ToString

Exit Sub ErrorHandler: MsgBox("Enter a numeric value, please.",, "Datatype error.") Resume Next End Sub

Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click With gallonsTextBox .Clear .Focus End With quartsLabel.Text = "" litersLabel.Text = "" End Sub End Class

In JavaScript
By contrast, the web port reduced this code to a simple set of JavaScript functions:



function getQuarts { var gallons = document.getElementById('gallons').value; var quarts = gallons * 4; document.getElementById('quarts').innerHTML = quarts; }

function getLiters { var gallons = document.getElementById('gallons').value; var liters = gallons * 3.78541; document.getElementById('liters').innerHTML = liters.toFixed(5); }