Coder Social home page Coder Social logo

take_out_food's Introduction

基础大练习:黄焖鸡

请用Java语言实现下面的需求,并且要求能够在控制台接受用户输入的参数。

需求描述

某快餐品牌推出了它独家的外卖应用,用户可以在手机上直接下单。该应用会根据用户选择的菜品(Item)、数量(Count)和优惠方式(Promotion)进行计算,告诉用户需要支付的金额(Charge)。 优惠活动有多种形式。假设用户一次只能使用一种优惠,那么使用哪种优惠省钱最多就会是一个让用户头疼的问题。所以该外卖应用为了方便用户,在用户下单时,会自动选择最优惠的方式并计算出最终金额让用户确认。 我们需要实现一个名为bestCharge的函数,它能够接收用户选择的菜品和数量(以特定格式呈现)作为输入,然后返回计算后的汇总信息。 已知:

  • 该店的菜品每一个都有一个唯一的id
  • 当前的优惠方式有:
  • 满30减6元
  • 指定菜品半价
  • 除菜品外没有其它收费(如送餐费、餐盒费等)
  • 如果两种优惠方式省钱一样多,则使用前一种优惠方式

take_out_food's People

Contributors

xy-zhou avatar

Watchers

 avatar

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.