7 Replies - 1418 Views - Last Post: 18 December 2013 - 04:13 AM Rate Topic: -----

#1 Marriss  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-December 13

I need help coding a cash register

Posted 17 December 2013 - 02:57 PM

I need help coding for this application, I'm not sure where I should start.


Write an application that duplicates the workings of a cash register. The cash register should open an inputbox requesting the amount of each purchase and loop until all purchases have been entered.

The number of purchases varies so do not hard code the number of iterations of the loop. Recall or look up what happens when you hit the cancel button on an inputbox, and use this to end the input loop.

The application adds all the items costs to arrive at a total then computes a sales tax of 5 percent and computes a total due.

The application will output as per the example below. Use a label, listbox, or messagebox for output. Your choice.

Acme Sales and Service
May 7, 2012

Item 1 14.95
Item 2 10,47
Item 3 9.95
Item 4 5.45
etc.
etc.

Total Sale 40.82
Tax 2.04

Total Due 42.86

Is This A Good Question/Topic? 0
  • +

Replies To: I need help coding a cash register

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9378
  • View blog
  • Posts: 35,224
  • Joined: 12-June 08

Re: I need help coding a cash register

Posted 17 December 2013 - 03:04 PM

Quote

I need help coding for this application, I'm not sure where I should start.

What have you thought about or tried?
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3608
  • View blog
  • Posts: 12,399
  • Joined: 12-December 12

Re: I need help coding a cash register

Posted 17 December 2013 - 03:05 PM

Have you started a basic form-application? You might add a Button that shows an InputBox. This would be a start.

Then you need some variables and a loop. The instructions are very clear.
Was This Post Helpful? 0
  • +
  • -

#4 Marriss  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-December 13

Re: I need help coding a cash register

Posted 17 December 2013 - 03:13 PM

Yeah I have the form done, I'm not sure what I should use for variables.
Was This Post Helpful? 0
  • +
  • -

#5 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,782
  • Joined: 26-March 09

Re: I need help coding a cash register

Posted 17 December 2013 - 03:46 PM

Don't think people are coming across as hard on you, but you need to put some thought into this yourself.

You said "I'm not sure what I should use as variables", so based on that, what did you consider using and what reasons did you choose not to use them?

As a starting point, have a look at this link on VB6 datatypes.

This post has been edited by maj3091: 17 December 2013 - 03:47 PM

Was This Post Helpful? 0
  • +
  • -

#6 Marriss  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-December 13

Re: I need help coding a cash register

Posted 17 December 2013 - 09:17 PM

This is what I have so far...

 Dim dblItem As Double = CDbl(Val(InputBox("Enter item price")))
        Dim dblSubTotal As Double
        Dim dblTotal As Double
        Dim dblTax As Double
        Dim dblAccum As Double
        Dim intCount As Double = 0

        lstCashRegister.Items.Add(dblItem.ToString("c"))




        Do While (intCount >= 1)

            dblAccum += dblItem

            dblSubTotal = dblAccum * intCount

            intCount += 1




            Exit Do




        Loop

        dblTax = dblSubTotal * 0.05

        dblTotal = dblSubTotal + dblTax



        lstCashRegister.Items.Add("Sub Total: " & dblSubTotal.ToString("c"))

        lstCashRegister.Items.Add("Tax: " & dblTax.ToString("c"))

        lstCashRegister.Items.Add("Total: " & dblTotal.ToString("c"))]

This post has been edited by modi123_1: 17 December 2013 - 09:23 PM
Reason for edit:: fixed botched code tags

Was This Post Helpful? 0
  • +
  • -

#7 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,782
  • Joined: 26-March 09

Re: I need help coding a cash register

Posted 18 December 2013 - 03:59 AM

And the problem you have is??

You need to define what you're looking for help with.
Was This Post Helpful? 0
  • +
  • -

#8 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3608
  • View blog
  • Posts: 12,399
  • Joined: 12-December 12

Re: I need help coding a cash register

Posted 18 December 2013 - 04:13 AM

This is VB.NET, not VB6. Topic moved.

BTW
Dim intCount As Double = 0

You've given this an integer prefix but declared it as a Double.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1