C#代写:CIS340 Campus Cafeteria

Introduction

这次作业是用C#代写一个校园自助餐厅的应用,实现基本的菜单处理逻辑。UI按照所给的example,用简单的命令行即可。

Requirement

Design a Campus Cafeteria application prototype complete with UML design documentation. Your application must match your delivered UML diagrams (all UML must be completed using the Astah UML tool). Your application shall take advantage of the C# programming language to provide a way to rapidly develop a working prototype.
The application will allow customers (both students & non-students) to purchase meals. Non-students will pay with a card and students will have the option to use their meal plan or pay with a card (in the event they are out of meal credits). A customer will select the meal type and quantity of meals then pay. Students will need to verify their identity to use meal plan credits or select to pay with card. As an incentive, Students who maintain a GPA over 3.5 are given 1 free meal. The Campus is on a tight budget so a limited number of meals will be served for each meal type.
Your application will utilize an object-oriented design. The delivered project must contain a class called Menu, Customer, and Meal. Certain classes will only be used as a class while others will require objects to be created. The application must have the following requirements:

Code

  • Menu class (rename program class or create a new class as shown in tutorials. “Program” will not be accepted as a Class name) doesn’t need any attributes. All data items should be declared within the Main method or other methods that are inside your Menu class code block.
  • Menu class will perform the following actions (can be methods):
    • Display a Main menu to get the meal type selection: breakfast, lunch, dinner, or exit. Include the number of meals remaining for each type of meal in the menu’s display (this should update after every purchase).
    • Ask the customer the quantity of meals they want to purchase.
    • After getting the meal type and quantity, Display the subtotal showing the meal type, quantity, and price along with a question to verify student account or continue as guest.
    • To verify a student account, ask for their Initials and Code. Test to see if an account exists that has matching (equal to) Initials and Code to determine which customer to use. If the entered Initials and Code do not match a customer’s Initials and Code, use a guest customer account by displaying Guest as the customer name (guest have $0).
    • After verification, display the customer’s name or guest and these Payment Choices:
      1) Use Meal Plan Credits
      2) Use Card
      3) View Plan Credits and Card Balance
      4) Cancel
      Note: Guests’ have $0 so no purchases, but all options should still function/selectable.
    • Selecting “Use Meal Plan Credits” will verify enough credits remain to cover the quantity of meals. When enough credits remain deduct the quantity of selected meals from the customer’s meal credits and save. In the event the quantity of meals selected is more than the credits remaining, display an error message and return to Payment Choices.
    • Selecting “Use Card” will verify the total (price + salesTax see next bullet) of meals can be covered by remaining balance on card. If card balance covers total, reduce the customer’s balance by the total and save. When the card balance is less than the total, display an error message and return to Payment Choices.
    • Verify the kitchen has enough meals remaining to fulfill the quantity of meals entered for purchase. You must verify meals remain for purchase in both situations of a customer paying with meal plan credits or money on their card. Display an error message showing the number of meals that remain and ask customer if they want to change the meal quantity. If yes, allow customer to enter new quantity and then return to Payment Choices otherwise return to Payment choices without entry of new quantity.
    • Upon a purchase with either meal credits or card balance, display a receipt. Include meal type, quantity, taxes (salesTax is 10%) on a new line and the totalPrice on a new line (equals subtotal * (1 + salesTax)). Format the display as follows then logout back to meal selection menu (Main menu).
      Note: SalesTax is ignored for customers paying with meal credits. Tax only applies to customer’s using a card to pay so you can choose to skip the display of tax when credits are being used to pay or you can show it every time. “Meals Remaining” above refers to the number of meals for that meal type that are left.
    • Selecting “View Plan Credits and Card Balance” will display the customer’s current meal credits and card balance available along with the customer’s data (Format nicely using dollar signs and data labels).
    • Cancel will clear the meal order and return to the main menu. Make sure the next order made does not contain any of the previous customer’s selections.
    • The system must update the number of meals available for each category (breakfast, lunch, dinner) in order to avoid overselling meals, but only if the purchase is completed. Otherwise the meals available should not be changed if the purchase is canceled.
    • All data like meals available and customer credits/balances must update over consecutive purchases. If a customer uses last credit, next purchase shows 0 credits.
    • Students who maintain honors status receive 1 free meal. Display a message on the receipt when a free meal is being awarded and show a deduction from the total meals selected (Total meals: 3 - 1 free meal so new total is 2). You choose message/format.
    • Repeat the above until “Exit” is selected. Once exit is selected, the application can end.
  • Customer objects will contain data (all data will be instance variables):
    • fistName – first name of the customer
    • lastName – last name of the customer
    • collegeName – name of the customer’s college
    • state – of residence, must only be two letters and all capital letters
    • gpa – a decimal number ranging from 0.00 – 4.00 (over 3.50 is honors status).
    • code – must be a 2 digit number, numbers only and non-decimal
    • credits – a whole number representing the number of pre-purchased meals from a plan.
    • balance – dollar amount in customer’s account (update after purchase). Format with a dollar sign and two decimal places.
  • Customer objects will perform all manipulations on the above customer data. Method ideas:
    • Set and Get any variable contained within the object because all variables listed above must be private. See Customer.cs from 8A as an example.
    • ModifyCreditBalance(), CheckHonorStatus(), FormatCustomerData(), ConfirmPurchase(), VerifyEnoughMoneyForPurchase(), VerifyInitialsAndCode(), VerifyCode(), VerifyInitials(), etc.
      Note: You can pick and choose from the above method ideas or make your own. Remember you are only allowed to assign to the customer variables within these methods. No assignment can be done in any other class/object because all variables will be private.
  • Meal class/objects will contain data (this can be a class with only static members or used to create objects with instance members. It will depend on how you decide to design the application, but it’s your choice on how to code it):
    • mealType – This will be breakfast, lunch, or dinner.
    • mealPrice – the price is determined by the meal type and is needed to calculate total.
    • mealQuantity – the number of meals ordered by customer (whole numbers only).
    • remainingMeals – number of meals left for each type. One variable for each meal type (breakfast, lunch, & dinner) if you use objects or an array is an idea if a class is used.
    • salesTax – percentage of sales tax to be applied to bill = 10%.
    • subtotal – quantity of meals multiplied by the price of the meal without tax.
    • totalPrice – the actual price to be paid by customer. Apply taxes using this formula: totalPrice = subtotal * (1 + salesTax). Don’t forget to apply honors discount (make sure you don’t apply the discount more than once as well).
      Note: subtotal and totalPrice do not have to be variables, but their values must be determined and manipulated by the Meal class or objects.
  • Meal class/objects will perform all manipulations on the above meal data. Method ideas:
    • Set and Get any variable contained within the class/object because all variables listed above must be private. See Customer.cs from 8A as an example.
    • DeterminePrice(), UpdateRemainingMeals(), ValidateEnteredQuantity(), CalculateSubtotal(), CalculateTotal(), CreditMealForHonorStatus(), etc.
      Note: You can pick and choose from the above method ideas or make your own. Remember you are only allowed to assign to the customer variables within these methods. No assignment can be done in any other class/object because all variables will be private.

UML

While completing the application, document your application using UML. Create a Class Diagram for your application showing objects, attributes, methods, relationships, relationship text, and multiplicities. In the class diagram make sure to identify the following for all objects:

  • Attributes and their data type
  • Methods with their defined return type and passing parameters
  • For all passing parameters make sure to have the parameter name and data type
  • Create relationships based on your code (if a class calls a method in another class there is a relationship).