Giter VIP home page Giter VIP logo

showplace_wage's Introduction

大观园的工钱

大观园内,凤姐身体有恙,连日不见好,只得把管家重任托付探春。转眼就是月末,探春姑娘打开账本,准备给贾府上下的丫鬟、奴仆们算工钱,当她看到账本上旁注的工钱计算规则,不禁蹙眉。

你道为何?原来,大观园内,下人的工钱计算相当繁琐,大致有如下三个规则:

第一,下人计算工钱时,分别有一个例钱因子,一个打赏因子,每位下人各各不同。 例如: 晴雯的例钱因子,是逢1、3、5...单月为900钱,逢2、4、6...双月为800钱;打赏因子固定为500钱。 麝月的例钱因子,是固定为600钱;打赏因子,则是上半年为400钱,下半年为700钱。 袭人的例钱因子,则是1、3季度为一吊钱(1000钱),2、4季度为一吊钱加500钱(1500钱);打赏因子,固定是两吊钱(2000钱)。 ...

第二,同一个下人,在伺候不同的主子时,所得工钱不同,每个主子分别有自己的工钱算法。 例如: 宝玉出手阔绰,每月支出工钱时,是把下人的例钱因子加上打赏因子,再乘以8倍。 老太太(贾母)也算大方,每月支出工钱时,是在下人的例钱因子和打赏因子中,取大的那个数,再乘以10倍。 王夫人比较小气,每月支出工钱时,是在下人的例钱因子和打赏因子中,取小的那个数,再乘以5倍。 贾政老爷,每月是把下人的例钱因子乘以4倍,打赏因子乘以2倍,二者相加作为工钱。 ...

第三,自从贾政发现怡红院中,宝玉整天和晴雯等丫头厮混在一起、不学无术,大为光火,于是在大观园内施行新规,丫鬟、奴仆们伺候哪个主子,不再固定,而是每月随机确定。 举例说明:假如10月份,晴雯姑娘被随机抽中去伺候贾政贾老爷,那么晴雯的当月工钱是这么计算的: 例钱因子,10月份是双月,因此是800钱;打赏因子是500钱。因此结合贾老爷的算法,晴雯工钱总数是8004+5002=4200钱。 ...

探春沉思半晌,想到每个月都要这般细算一番,好生头痛,因此决定雇你写一个软件,帮她计算每月丫鬟、奴仆们的工钱。

要求如下:

  • 1、只需给出配对的下人和主子,就能自动统计出这个下人的当月工钱。
  • 2、新增主子,或者新增下人时,不能改动原有算法,也不能改动原有数据结构。
  • 3、可以使用面向对象方式实现,或者使用函数组合方式实现,比较一下这两种方式的差异、优劣。
  • 4、使用TDD方式开发,要求有足够的自动化运行测试用例。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.