Sponsored Content
Full Discussion: Cash Register Change Program
Top Forums Programming Cash Register Change Program Post 302927189 by sea on Monday 1st of December 2014 11:53:15 AM
Old 12-01-2014
Eventhough BASH is my currently my most favorite language, for (possibly) 'real' applications, specialy when it comes with numbers handling as in do math, i would choose something else... like python.

AFAIK, awk is no programing language, but a 'streaming/parsing' tool.
(simple said)

Me quite confused by your syntax.
There is:
Code:
init 50 = 0 1 4 20
purchase 38 = 2 0 0 0

But there is also
Code:
change 0 0 0 1 = 5 1 1 0
change 0 1 = 5

To me this looks like you want to do 2 things at once, while the programing itself, would might be logical, think of what the cashier must do to enter this syntax!

Usualy the chashiers just type in the amount of cash the items costs, and the 'added up' amount the buyer pays. They do NOT count every single piece of cash, and enter 2x5$ 1x10$, 3x20$, etc...
They simply type: 78$ cost -> 80$ paid, returns -> 2$ returns.

I agree, it WOULD be a nice-to-have feature, but for the cashier its very unpractical to count the cash (not the value) each and every time, all day long, when there are 50 people at the register waiting..

Get my point? Smilie
In the end, a cash register is more like a big calculator, sure, it contains cash, but in the end, it just sums up the values, and not the counts of cash-items.
That is done at the evenings, manualy. (unless they have a cash counter- another device)

So my only suggestion is to make the syntax simpler.

Change only: VALUE
Pay: COST GIVEN
-> Returns: return/change

So you would only need to catch 2 arguments.


However, if you plan to do this as a 'backend', as in you then could make the GUI having fields to enter the amount of every single cash-item, which then, if there is something within the text field, pass this value as optional value to the script.
As in:
Pay: -twenty 1 -five 1 COST(22) paid(sumy up the textfield=25)
Returns: Return 3
(since there were optionas passed, show) Flow: +10 +5 -2 -1
While the italic text would be generated by the GUI, since there were only 2 (optional) textfield filled)

Hope this helps

EDIT:
Alternativly, you could expect:
Pay: COST / GIVEN
And simply split up the GIVEN to a possiblity of cash combinations.
This User Gave Thanks to sea For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Program Change Question

I am an IT auditor with a big 4 accounting firm and am cur the process of conducting an application program change audit for a large public company related to Sarbanes Oxley. This is my first time using this forum and need some assistance in verifying a fact that I believe to be true. My client... (1 Reply)
Discussion started by: mpp122
1 Replies

2. Shell Programming and Scripting

script/program to change the password ?

hi, Somebody have or known where i can find a perl small perl program to change the password. The point: First it verify is the user exist, checking the old typed password and replace it with new. The passwords must be encoded. Thanks, very much! (0 Replies)
Discussion started by: kad
0 Replies

3. UNIX for Advanced & Expert Users

Finding register set being used in program

How can i find( or list) contents of all registers being used by my program? Is there any system call or library available for this?:confused: At runtime in my c/c++ program. At runtime using may be some assembly hack!!!!!!!!!!! (2 Replies)
Discussion started by: amit gangarade
2 Replies

4. Programming

Change Pseudo Code to C Program (print and fork)

I am very new at programming and this is probably an easy question, but I am desperate. I need to change this low level code into a C program that I can run so I can print out every "A" that appears with the fork() command. You help is greatly appreciated. PRINT A p=fork() if( p == 0) {... (0 Replies)
Discussion started by: tpommm
0 Replies

5. UNIX for Dummies Questions & Answers

Create a simple ATM (Cash machine simulation)

I need to create a simple ATM (Cash machine simulation in unix) which shows a welcome screen, then a login screen to enter 3 users details. help please on the coding The users details need to be in a txt file: the details are: (PIN No, First name last name, Account number, Balance, Histrosy) ... (1 Reply)
Discussion started by: oobla01
1 Replies

6. Homework & Coursework Questions

Simulate a ATM (cash machine) on UNIX(Putty) using scritps

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I need to create a simple ATM (Cash machine simulation in unix) which shows a welcome screen, then a login screen... (2 Replies)
Discussion started by: oobla01
2 Replies

7. Debian

Change the privileges needed to run a program

Hi everyone, I have an issue with a project of mine. I have to run a program on a terminal which requires to be logged in as su to have it run it. Given that I'm having problem to use expect to give the password I'd like to change the privilege of that program from SU to normal user ( I have the SU... (13 Replies)
Discussion started by: gaisselick87
13 Replies

8. UNIX for Dummies Questions & Answers

Change to different user id inside a program

Hi, There is a process ( built in C/C++) which starts with my user id and I need to execute a specific function with a different user id. Is there any api so that I provide userid, passwd and the next instance the process will have the new user id privileges. - Pranav (3 Replies)
Discussion started by: k_pranava
3 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 06:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy