视觉c++用于自动售货机的硬币找零系统
最近,我接到一项任务,用 C++ 开发一个新项目……我花了几天几夜思考如何实现它……不幸的是,这个想法还没有成功,目前正处于设计阶段。基本上,前提是:
“当地一家知名百货公司 Ruddles 的管理层决定对整个商店的顾客收银台进行某些更改。由于工作人员在为顾客提供正确的购买零钱方面存在问题,未来,零钱将根据商品价格和客户支付的金额自动计算,钱币将由收银机自动分配,而收银机即将被能够机械分配的机器所取代。”
只是有关业务本身的一些信息。以下是给我的需求说明:
“目前,工作人员(收银员)将输入采购内容,系统将计算总成本。系统的这部分目前运行良好,并且预计不会发生任何变化(!)。总成本将转嫁给新机器,并且还将输入客户投标的金额。 然后,系统将计算到期的找零金额,并向硬件接口提供硬币面额列表以及要分配的每种硬币的数量。 这是练习的第一部分。然而,管理层刚刚意识到硬币分配机需要不时补充硬币,并希望系统能够记录不同面额的硬币数量,并在硬币数量超过时发出警告。任何给定面额的硬币都会跌破一定的价值。因此,您应该在您的解决方案中包含提供此类规定的设施。 目前,硬件无法分发票据,但未来的发展可能使其成为可能,并且您的解决方案应该能够在发生这些改进时应对这一问题。因此,您应该指出,如果发生此类硬件升级,软件需要进行哪些更改。”
目前,我真的不确定如何满足项目的以下要求,所以我只是想知道是否存在以下任何问题:比我知识渊博、经验丰富的您可以提供一些意见或建议,我们将非常感谢您的时间和关注:-)
我知道可能有多种方法可以实现这一点,但到目前为止我了解数组需要虽然我不完全是要使用的和持久性结构当然..
幸运的是,只要它能再次完成工作,我就很感激您给我的任何建议或提示,谢谢。
recently i've been given an assignment to work on a new project in c++...and i've been doing some thinking for some days and nights on how to approach it....unfortunately the thinking hasn't worked out and currently struggling on the designing phase. Basically the premise is:
"The management of Ruddles, a well known local department store has decided to implement certain changes to the customer tills throughout the store. Because of problems with staff in providing customers with correct change for their purchases, in future the change will be calculated automatically from the price of the goods and the amount tendered by the customer. The coins will be dispensed automatically by the tills, which are about to be replaced with machines capable of mechanical dispensing."
this is just some information about the business itself. the following is the requirement specification given to me:
"As at present, the member of staff (the cashier) will enter the purchases, and the system will calculate the total cost. This part of the system currently operates satisfactorily, and no changes (!) are envisaged. The total cost will be passed to the new machine, and the amount tendered by the customer will also be entered.
The system will then calculate the amount of change due, and will provide the hardware interface with a list of coin denominations and the number of each to be dispensed.
This constitutes the first part of the exercise. However, management has just realised that the coin dispensing machines will need to be replenished with coins from time to time, and would like the system to be able to keep track of the numbers of coins of different denominations, and issue warnings when the number of coins of any given denomination falls below a certain value. You should therefore include facilities to provide such provision in your solution.
At the present time, the hardware is unable to dispense notes, but future developments may make it possible, and your solution should be such as to cope with this should theses improvements occur. You should therefore indicate what changes would be necessary to the software in the event that such hardware upgrading takes place."
At the moment im really unsure on how to approach the following requirements for the project so im just wondering if any of you who are far more knowledgeable and experienced than me can lend some advice or suggestions, this will be much appreciated for your time and attention:-)
Im aware that there may be multiple ways this can be approached but so far i understand that arrays need to be used and a persistence structure as well although im not entirely sure..
fortunately it doesn't have to be overly completed so long as it does the job. again i appreciate any advice or tips you can give me. thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所描述的“软件”具有输入:总购买量和客户提供的总金额,以及输出:硬币面额列表和每种硬币的数量。对我来说听起来像是函数的定义。为每个参数找出一个好的数据类型,并写出函数的签名。
The described "software" has inputs: the total purchase, and the total tendered by the customer, and outputs: a list of coin denominations and the number of each coin. Sounds like the definition of a function to me. Figure out a good data type for each parameter, and write out the signature of your function.
如果我是你,就从简单的开始。假设你只有一种硬币类型,然后想出一些适合它的硬币。然后,将设计扩展到两种不同价值的硬币。之后,您将对需要什么有更好的感觉,并且您应该能够了解如何扩展您的解决方案以应对具有多种不同面额的硬币。
在其他一些基础知识发挥作用之前,也请忘记持久性部分。
如果你尝试在头脑中设计整个事情而不实际执行任何代码,你的大脑可能会爆炸。因此,请将问题分解为您可以管理的部分。
这听起来是一个有趣的问题,祝你好运!
If I were you, start simple. Pretend you've only got one coin type, and come up with something that will work for that. Then, extend the design to two coins of different values. After that you'll be getting a far better feel for what is needed, and you should be able to see how to extend your solution to cope with coins that have a number of different denominations.
And also forget about the persistence bit until you've got some of the other basics working.
If you try and design the whole thing in your head without actually implementing any code, your brain might explode. So, break the problem down into chunks you can manage.
It sounds like a fun problem, good luck!