联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-11-12 11:13

HONG KONG INSTITUTE OF VOCATIONAL EDUCATION (TYING YI)

DEPARTMENT OF INFORMATION TECHNOLOGY

HIGHER DIPLOMA IN SOFTWARE ENGINEERING (IT114105)


Module Name: Contemporary Topics in Software Engineering


Module Code: ITP4507


Assignment Number: One


Hand-in: 13 November 2020 (On or before 4:30 PM

to Assignment Collection Boxes outside C440 and Moodle)


Weighting of This Assignment: 50% of the End of Module Assessment


This assignment must be done by individual only. Plagiarism will be treated seriously. Any assignments that are found involved wholly or partly in plagiarism (no matter the assignments are from the original authors or from the plagiarists) will score Zero mark. Late submission will NOT be accepted.

----------------------------------------------------------------------------------------------------------------------

Task Specification


A company has a staff canteen which provides catering service for its staff.  Both eat-in and take-away services are provided by the canteen. Recently, due to the COVID-19, restrictions about canteen accommodations for eat-in service have to be observed. The company management wants to encourage the staff to stay in the company for lunch in order to lower the risk of infection.  Therefore, the company has decided to subsidize the canteen to provide low-price and high-quality Business Lunch Sets via a new ordering system called Business Set Lunch Ordering System (BSLOS). Staff can order Business Lunch Set at an attractive price and the canteen will deliver the meal to the staff office directly.


Initially, the company will provide two kinds of Business Lunch Set: Chinese style and Western Style. The Chinese style set includes a main dish with rice, a cup of Chinese style soup, and a cup of Oolong tea (hot or iced). The Western style set includes a main dish with one starch side dish which could be chosen from rice, spaghetti or French fries, a cup of Western style soup, and a cup of coffee or tea (hot or iced). Only limited number of lunch set of each style will be available each day. The main dish of each style of lunch set will be changed on each day and the price of a lunch set may also be changed depending on the main dish.


The menu will be available at 9:00am every day, showing the details including the price and the available count. After viewing the menu, the staff can choose either the Chinese style or the Western style and specify the relevant options, then enter staff number and office location to make order.  The available count will be updated accordingly when an order is received or cancelled. The orders will be handled on a first-come-first-served basis and the delivery will start at 1:00 PM.


You are required to design the BSLOS. Note that if the scheme is well-liked by the staff, the company may consider to add more kinds lunch set. So, your design should conform with the Open-Closed Principle and allows flexibility and extensibility for future enhancement.


You are also required to design and develop the BSLOS.  BSLOS should provide the following functions:

1.Edit menu

2.Show menu (display lunch sets with available counts)

3.Make order

4.Cancel order

5.List outstanding orders (orders which have not been completed)

6.Mark order as completed


You are required to apply the following patterns in your system design

?Command Pattern to provide the “Edit menu”, “Show menu”, “Make order”, “Cancel order”, “List outstanding orders”, “Mark order as completed” functions

?Factory Method or Abstract Factory Pattern to create different kinds of Command objects and different kinds of Lunch Set.

?Memento Pattern to support the “Cancel order” function


Your system design should conform to the Open Closed Principle so that your design should easily be extended to support new functions and the creation of new Lunch Sets, Soups and Drinks.


Assignment Report

In addition to the system development, you are required to write up a Short Report covers the following sections:

  1. Assumptions regarding the problem context

  2. Application design with class diagram

  3. Discussion and explanation on each of the design patterns applied to the application.

  4. User Guide

  5. Test Plan and Test Cases

  6. Well documented Source Code    


Mark Allocation

Your assignment work will be marked according to the following criteria.

WorkMark Allocated

System Coding and Implementation

a)Implementation of the system and coding style *

(Hard-coded output will result in zero mark.)30%

b)Correctness of system functions *

(Hard-coded output will result in zero mark.)15%

c)User Guide5%

d)Test Plan and Test Cases

(Will be used in testing your own application.)  5%

System Analysis and Design, and Discussion

e)Design of your system and correct use of design patterns20%

f)Application design with class diagram10%

g)Discussion and explanation on each of the design patterns applied to the application15%

Total100%

Note: * Please note that your source code will be recompiled and tested for the correctness of the system functions. Your implementation is required to support the 'Copy and Paste' method for testing which is described in page 10.

Submission of Assignment Work

1.The front page of your submission should include the programme title, module title, student identity number(s), student name(s), and group number.


2.Submit a hard copy of all your following work to Assignment Collection Boxes outside C440 and submit a zip file of all your work to the module’s Moodle website:

?Well documented Source Code of your program. Store the Source Code files in Folder “source code\” of your zip file. Store compiled class files and the “run.bat” file for executing the program in Folder “bin\” of your zip file.

?Report for analysis, design, discussion, user guide, test plan and test cases of your following work. Store the report in Folder “report\” of your zip file.  

A.The assumption made during analysis and design of the application

B.System design on your application with class diagram

C.Discussion on the design patterns that applied on your program

D.User Guide and Test Plan with Test Cases (describe how your program works and develop different test cases for testing each functionality of your program – please include all the required screen dumps).


3.Submit according to the guideline on the top part of cover page. Late submission will NOT be accepted.



Testing Method

This sample run is served for reference only. You are free to design your own user interface.  But to make the testing environment simple and to apply the "Copy and Paste" testing method described on page 9 easily, you are advised to accept user input at the command prompt as shown in the sample run below.


Sample Run of assignment

You may follow the design of user interface shown in this sample run in command prompt.

User’s inputs are in italics and in green.


Test Cycle 1

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

e


Edit Menu:

Chinese or Western (c | w): c

Enter main dish: Steamed Fish

Enter price: 30

Enter available count: 3

Menu Updated


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

e


Edit Menu

Chinese or Western (c | w): w

Enter main dish: Steak

Enter price: 40

Enter available count: 3

Menu Updated


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

s


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 3


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 3

Test Cycle 2

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): c

Oolong Tea: hot or iced (h | i): h

Staff Number: 123

Office Location: 123

Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): w

side: rice, spaghetti, French fries (r | s | f): f

tea or coffee, hot or iced (ht| it | hc | ic): ic

Staff Number: 987

Office Location: 987

Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

s


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 2


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 2


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee


Test Cycle 3

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): c

Oolong Tea: hot or iced (h | i): i

Staff Number: 234

Office Location: 234

Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): c

Oolong Tea: hot or iced (h | i): h

Staff Number: 345

Office Location: 345

Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 234, 234, Steamed Fish, Chinese Soup, Iced Tea

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): c

Sold Out!  



Test Cycle 4

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

c


Cancel Order

Staff Number: 234

234, 234, Steamed Fish, Chinese Soup, Iced Tea

Order Cancelled


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

p


Place Order

Chinese or Western (c | w): c

Oolong Tea: hot or iced (h | i): i

Staff Number: 456

Office Location: 456

Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea




Test Cycle 5

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

s


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 0


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 2


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

d


Complete Order

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

Order marked as done


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit

l


Outstanding Orders

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea




You can ease the testing by using the 'Copy and Paste' method rather than inputting data manually. Prepare a text file, which includes all user inputs in a test run. By using the 'Copy and Paste' method, you can automatically input in the command prompt window and then get the result automatically (without the input data echoed). The following is an example of the text file for user inputs.

Sample User Inputs for a Test Run

Expected Output of the Test Run

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Edit Menu:

Chinese or Western (c | w): Enter main dish: Enter price: Enter available count: Menu Updated


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Edit Menu

Chinese or Western (c | w): Enter main dish: Enter price: Enter available count: Menu Updated


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 3


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 3

Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w): Oolong Tea: hot or iced (h | i): Staff Number: Office Location: Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w): side: rice, spaghetti, French fries (r | s | f): tea or coffee, hot or iced (ht| it | hc | ic): Staff Number: Office Location: Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 2


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 2


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w): Oolong Tea: hot or iced (h | i): Staff Number: Office Location: Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w): Oolong Tea: hot or iced (h | i): Staff Number: Office Location: Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 234, 234, Steamed Fish, Chinese Soup, Iced Tea

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w):

Sold Out!  


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Cancel Order

Staff Number: 234

234, 234, Steamed Fish, Chinese Soup, Iced Tea

Order Cancelled


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Place Order

Chinese or Western (c | w): Oolong Tea: hot or iced (h | i): Staff Number: Office Location: Order Placed


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Chinese style Business Set Lunch

main dish: Steamed Fish

with rice, Chinese soup, Chinese tea

price: 30

available count: 0


Western style Business Set Lunch

main dish: Steak

with rice/spaghetti/French fries

price: 40

available count: 2


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Complete Order

C: 123, 123, Steamed Fish, Chinese Soup, Hot Tea

Order marked as done


Please enter command: [e | s | p | c | l | d | q]

e = Edit menu,   s = Show menu,   p = Place order,   c = Cancel order,

l = List orders,   d = order is Done,   q = Quit


Outstanding Orders

W: 987, 987, Steak, French fries, Western Soup, Iced Coffee

C: 345, 345, Steamed Fish, Chinese Soup, Hot Tea

C: 456, 456, Steamed Fish, Chinese Soup, Iced Tea




Requirement for Scanner usage


Wrong Scanner usage (more than one object of Scanner is created for reading keyboard input):

// create new Scanner objects in loop

do {

Scanner sc = new Scanner( System.in);

choice = sc.nextInt();

} while (choice != 1);


Correct Scanner usage (only one Scanner object is created for reading keyword input):

Following is an example program to use a Global Scanner object or pass as a parameter to do the input.


import java.util.Scanner;


public class Test {

 //Global declaration for Scanner

 public static Scanner sc = new Scanner(System.in);


 public static void main(String args[]) {

   int x;

   System.out.print("Enter x:");

   x = sc.nextInt();

 }


 public static void method1() {

   int y;

   System.out.print("Enter y:");

   y = sc.nextInt();

 }


 public static void method2(Scanner sc) {

   int y;

   System.out.print("Enter y:");

   y = sc.nextInt();

 }


}



*** END ***


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp