Help with VB

nabil

Member
Mar 4, 2007
7,320
1
0
35
North Carolina / Kandy
I have been asked to do a project on vb when i have no clue about vb :sorry:
So guyz pls try n help me out to code this sytem. pls!!
I basically have been asked to write a program to simulate the display of one petrol pump in a petrol station. this is a seven segment lcd. So i have to programme a number to be shown as seven segments.

In the petrol shed's office there is a console. in this console the amount of petrol sold and price of the current transaction has to be shown and also the total sales for the day and no.of litres sold for the day.

The guy in the office who has the console should be able to change the price per litre, zero the amount of petrol dispensed, view the total amount of petrol sold (as i told earlier) n zero the total sales at the begining of the day.

So i made the interface of the console:

projectpx1.jpg



I know I have to add more buttons to this. and i have to create a database as well.

SO can sum1 pls pls guide me through. None of us in the class know vb. Even the teacher knows that. but u c life is tough.

Click HERE for the detailed specification
 
Last edited:

nabil

Member
Mar 4, 2007
7,320
1
0
35
North Carolina / Kandy
Heres the detailed specification


19.2 Background


Petrol stations selling petrol usually show prices and amount of
petrol dispensed on each petrol pump and also have a console in the
office showing information about each sale from each petrol pump
on the garage forecourt.
Each petrol pump shows how much petrol has been sold, the price
per litre in pence to one decimal place and the total amount to pay.
The console also displays this information for each pump.
Peter owns a small petrol station with one petrol pump. Every day
Peter needs to know the number of litres of petrol that are sold and
the total amount of money taken for the pump.
You have been asked to write a PROGRAM to simulate the display
on the pump and on the console.
The system you are to develop is simplified and should not include
details about taking money from the customers but just assume that
the amount displayed is the amount of money received. Also you are
not required to test for the customer’s petrol tank overflowing when
the petrol is being dispensed.


19.3 Specification


1. You have been asked to write a program to simulate the display of
one petrol pump only and the console. The program needs to
record the amount of petrol sold in tenths of a litre and the amount
to be paid in pounds and pence every time the pump is used.
The display on the petrol pump uses seven segment LCDs (Liquid
Crystal Displays). As part of your programming you will need to
write and test a procedure to display a number as a seven segment
figure. The console must also display the total amount of money
taken but does not need to use an LCD.
XXX.XX Amount to Pay (£ p)
XX.X Litres
XXX.X Pence per litre
Note to teachers: if a candidate is unable to write a procedure to
simulate a seven segment LCD display successfully, a simplified
display could be programmed but the candidate may be unable to
provide appropriate evidence to answer some questions set in the
examination.
Computing - Advanced Subsidiary and Advanced, 2008 examination
44 klm


2. Peter at the console can:
• set and change the price per litre in pence
• zero the amount of petrol dispensed (this will also
automatically zero the amount paid)
• view the total takings and total petrol sold
• set the total takings and total petrol sold to zero at the
beginning of each day.


3. The customer buying petrol can:
• remove nozzle from holster to indicate they are ready to
buy petrol
• squeeze the nozzle to put petrol in the tank
• stop squeezing the nozzle to stop putting petrol in the
tank
• replace the nozzle to finish putting petrol in the tank
Each of the above can be simulated by keystrokes or the use of a
button or similar.


4. The petrol pump displays:
• the current price in pence per litre to 1 decimal place as seven
segment LCDs
• the amount of petrol dispensed at any time as seven segment
LCDs showing the number of litres to one decimal place.
This display remains after the petrol has been dispensed until
zeroed by Peter from the console.
• the amount to be paid at any time as seven segment LCDs
showing the amount in pounds and pence. This display
remains after the petrol has been dispensed until the number
of litres of petrol dispensed has been zeroed by Peter.
The pump can dispense between 0.5 and 100 litres in tenths of a
litre. The price per litre can be up to 199.9 pence per litre.


5. The console displays:
• The state of the pump:
o ready for use (display set to zero customer can start
putting petrol in the tank)
o in use
o out of use (waiting for Peter to zero the display)
• the amount of petrol being dispensed by the pump when it is
in use, showing the number of litres to one decimal place.
This display remains after the petrol has been dispensed until
zeroed by Peter.
• the amount to be paid when the pump is in use in pounds
and pence. This display remains after the petrol has been
dispensed until the number of litres of petrol dispensed has
been zeroed Peter.
Advanced Subsidiary and Advanced, 2008 examination - Computing
klm 45
When the nozzle is replaced in the holster the amount of petrol
dispensed is added to the total amount for that day, and the amount
paid is added to the total amount paid from all the sales that day.
The pump is flagged as out of use until the number of litres
dispensed is zeroed on the pump and the console, it is then set as
ready for use by the next customer.
 

x-pert

Member
Jun 13, 2006
20,952
77
0
A source to get a quick idea about vb.
http://www.homeandlearn.co.uk/NET/vbNet.html


Check these for your specific question machang :)

http://groups.google.com/group/uk.education.schools-it/msg/17fb72e61145d1a1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2597494&SiteID=1

http://myreader.co.uk/msg/10412777.aspx (This is good)



Thought this might be get handy as well ;)
http://www.scribd.com/doc/94761/AQA55116511WSP08
(Click on the "view full screen button")



After going through these, ask any thing more machang. Hope this'll help you to start the project.
 

nabil

Member
Mar 4, 2007
7,320
1
0
35
North Carolina / Kandy
x-pert said:
A source to get a quick idea about vb.
http://www.homeandlearn.co.uk/NET/vbNet.html


Check these for your specific question machang :)

http://groups.google.com/group/uk.education.schools-it/msg/17fb72e61145d1a1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2597494&SiteID=1

http://myreader.co.uk/msg/10412777.aspx (This is good)



Thought this might be get handy as well ;)
http://www.scribd.com/doc/94761/AQA55116511WSP08
(Click on the "view full screen button")



After going through these, ask any thing more machang. Hope this'll help you to start the project.
the myreader link was on the same scenario of the AQA computing syllabus.
But will u be able to tell me to code a few basic stuff to just make my teacher happy tomorro :D
 

x-pert

Member
Jun 13, 2006
20,952
77
0
nabil said:
the myreader link was on the same scenario of the AQA computing syllabus.
But will u be able to tell me to code a few basic stuff to just make my teacher happy tomorro :D
Read the myreader stuff and tell them to the teacher machang :rofl: As far as I can see, that is a discussion between few teachers.

It tells something about:

The Petrol Pump display is actually not as hard as the scare stories
that I have heard flying around. The principle is to set up a
primitive drawing subroutine that can draw a line, from one set of x,y
coordinates to another (with an appropriate pen width and a triangular
start and end cap). Call this seven times with the right coordinates
and you can draw an 8. Next, introduce the idea that if you have two
pens, one coloured and the other blank (same as the form's
background), then you can draw any digit. Set up ten routines,
Zero(), One(), etc... to draw the correct bars to represent each
digit. Ok, so now we can draw a digit, any digit. Next, get them to
write a routine to make their one-digit display count. As
soon as they introduce some Do While - Loops, make sure they
understand the need for an Application.DoEvents() inside the loop or
they won't be able to process any interrupts (mouse-up for the pump).
I would suggest a Select - Case statement to process the digit you are
trying to display, keeps it neat and easier to understand.

Hopefully, they will have a counting digit, that goes 0-9, or some
such, which they may/may not need to slow down a little to see the
counting, depending on how inventive they are.

Next, they need to think about how to display a number larger than 9.
Introduce a FuelLitres variable, that you will increment by .01 inside
a Loop in the MouseDown routine, (here is where the
Application.DoEvents() becomes critical), the only exit from which is
when you reach a pre-determined fuel limit or when the system traps
the MouseUp event. Displaying the fuel (and from that the price) is
an inner loop encapsulating the Select-Case statement to display any
single digit. I will just explain the fuel display... the fuel cost
is a natural extension of this. It goes without saying that this is
not something you want to give to your students directly and I am sure
that there are other ways of doing it.

The basics of all decimal systems is that you multiply by 10 every
decimal place you move to the left, so... In the following routine,
FuelLitres is the amount of fuel, segment is a variable that we will
(in the end) pass to our drawing routine to offset our drawn digit,
depending on whether we are drawing in the Unit, Ten, Hundred, etc...
position. running is a boolean that is set to true when the pump
handle is "lifted". flag is a boolean that we will set to true in the
MouseUp routine, to provide an exit. workvar and OneDigit are integer
variables to hold the fuel value to display and the single digit from
each part of the number that will be stripped out in turn
respectively. DrawMyDigit() is a sub that contains the Select-Case
statement to draw any digit.

Do While FuelLitres < 100 And running And Not flag
segment = 0
FuelLitres = FuelLitres + 0.01
workvar = FuelLitres * 100
Do While workvar > 0
Application.DoEvents()
OneDigit = workvar - (Int(workvar / 10) * 10)
DrawMyDigit(OneDigit, segment)
workvar = Int(workvar / 10)
segment = segment + 1
Loop
Loop

After that, you need to consider a vertical offset for the various
numbers (price, fuel, price per litre) to be displayed.
|
|

__
__|
|__

__
__|
__|

|__|
|

__
|__
__|

__
|__
|__|

__
|
|

__
|__|
|__|

__
|__|
__|

__
| |
|__|

Above are the 7 segment numbers.

{Edit: Sorry this EK editor doesn't allow spaces before a character}
 
Last edited:

madurax86

Member
Jun 29, 2006
4,385
88
0
for VB6 u can use a function
ex:
--------------------------------
const cPumpSpeed=1
const cLitrePrice=117 'isnt it not sure:P?
public curVol,curPrice as double

Function StartPumping()
timer1.enabled=true
timer1.interval=1 'a setting for speed
End Function

Function StopPumping()
timer1.enabled=false
end function

Private Sub timer1()
curVol = curVol + cPumpSpeed
curPrice=curVol*cLitrePrice
'format the number n use 7 segment frm here if u want it tel me i'll post:p
end sub
 

nabil

Member
Mar 4, 2007
7,320
1
0
35
North Carolina / Kandy
x-pert said:
Read the myreader stuff and tell them to the teacher machang :rofl: As far as I can see, that is a discussion between few teachers.

It tells something about:


|
|

__
__|
|__

__
__|
__|

|__|
|

__
|__
__|

__
|__
|__|

__
|
|

__
|__|
|__|

__
|__|
__|

__
| |
|__|

Above are the 7 segment numbers.

{Edit: Sorry this EK editor doesn't allow spaces before a character}
yea but the problem is getting numbers to be shown like that :(