visual Basic
CSEN 2303 – Introduction to Computing Using Visual Basic and Excel
1
Assignment 1
Due on Tuesday, September 26 by 5:00pm via Blackboard
In this assignment you are to create a Visual Basic application for the VB gas station. The application should be able to calculate the total price for a visit to the station.
Visitors to the VB gas station can purchase either unleaded fuel, premium fuel, or
both unleaded and premium fuel.
Your program should:
o provide input fields where the amount of each type of fuel to be purchased can be entered
o provide output fields where the subtotal charges for both unleaded and premium fuel purchases can be displayed
o provide an output field where the total price for the visit to the gas station can be displayed
o include appropriate labels for all input and output fields in the interface o provide a “Calculate” button that when pressed will read input values for the
gallons of unleaded fuel to be purchased and the gallons of premium fuel to be
purchased and then calculate and display the unleaded subtotal charge, the
premium subtotal charge, and the total price for the visit to the gas station
o format each of the output fields using the ToString() method so that a dollar sign is printed in front of the number and two digits of precision are displayed.
o provide a “Clear” button that when pressed will reset the form so the two input fields and three output fields are all blank (just like when the program starts
running)
o provide an “Exit” button that when pressed will close the application o define access keys for the buttons in the user interface o establish the tab order for interface controls so that the input area for the “Gallons
of unleaded” is selected first, followed by the “Gallons of premium” input area,
followed by the “Calculate” button, the “Clear” button, and then the “Exit” button
o include a PictureBox to display an image that is appropriate for a gas station application
Two sample user interface screens are shown below, the first illustrates the
application when it first starts running, the second shows the result of pressing the
“Calculate” button when the corresponding values have been input. The user
interface of your application does not have to be exactly the same as the examples
below, but should be functionally equivalent.
Make sure to add a heading comment in your source code to specify your name, K
number, and a brief description of the code (note: heading comments are placed
before the class name in the source code). Also make sure to include additional
comments within the source code (at least one comment per procedure to describe its
function).
CSEN 2303 – Introduction to Computing Using Visual Basic and Excel
2
When finished, make a zip file of the folder created for the project and submit the file
to the corresponding assignment on the BlackBoard system.