You are on page 1of 11

Buffet Restaurant

1.0 Introduction

1.1 Functional Requirements


Delicious Buffet Restaurant is one of the leading buffet dining chains in Tamil Nadu. It pioneered the
concept of “Unlimited Food for the Customer”. The Price chart is fixed for the Adults and Kids (5-9
years) under vegetarian and non-vegetarian categories. They are in need of a separate online portal for
generating bill for the customers based on adults count and kids count under vegetarian and non-
vegetarian and hall type. Create a Spring MVC Spring Boot Application for developing a Buffet Bill
Generation application. Design a Bill Generation Page to choose an appropriate Hall Type (AC or
NonAC) and adult count, kids count under vegetarian and non-vegetarian. On clicking Calculate Cost,
the application should calculate the total cost depending on the hall type chosen and the kids, adults
count given by the customer. The consumer has to then be redirected to billdesk.jsp page that displays
the message “Thanks for Booking!!! Total Amount to be paid is Rs.<<totalCost>>”.

1.2. Use Case Diagram

2.0 Technical Specifications

2.1 Process Flow

 The first page of the application is showpage.jsp page, this page should have the below form
components.
Component Component Type Component ID
Customer Name Textbox customerName
Contact Number Textbox contactNumber
Hall Type Drop down hallType
Adult Count For Veg Textbox adultVegCount
Kids Count For Veg Textbox kidsVegCount
Adult Count For Textbox adultNonVegCount
NonVeg
Kids Count For NonVeg Textbox kidsNonVegCount
CalculateCost Submit submit

 In the same page we have the provision to choose language English, German and French. By
default, the page content will be displayed in English. If we choose the language as French the
label content and the error message in the page should displayed in French and if we choose the
language as German the label content and the error message in the page should displayed in
German. Ensure you implement the concept of Internationalization.
 In the showpage.jsp page, ensure you use the component type and id correctly as specified in
the above table.
 The values in the hallType drop-down must be auto populated from the controller with the
values as given in the below table. They should not be populated / hardcoded inside the JSP.
hallType
AC
NonAC

 Sample showpage.jsp for displaying the page content in English

 Sample showpage.jsp for displaying the page content in German


 Sample showpage.jsp for displaying the page content in French

 The CalculateCost button, on-click after all successful validations (Refer 2.2 for validation),
must generate the total Bill amount based on the hall type and kids, adult count under
vegetarian and non-vegetarian categories in the billdesk.jsp file. In this page the message
should be displayed as “Thanks for Booking!!! Total Amount to be paid is
Rs.<<totalCost>>”. The result should be rendered inside the <h2> tag. Refer 2.3 for the logic
to be followed for doing calculation.
2.2 Business Validation

 Rule: Customer Name field is mandatory.


 Message: Customer Name cannot be empty in <<locale>>
o If validation fails, UI should display the error message - “Customer Name cannot be
empty in <<locale>>”.
 Rule: Contact Number cannot be empty
 Message: Contact Number cannot be empty in <<locale>>
o If validation fails, UI should display the error message - “Contact Number cannot be
empty in <<locale>>”.
 Rule: Adult count for Veg should not be a negative number.
 Message: Adult count for Veg should not be a negative number in <<locale>>
o If the validation fails, UI should display the error message - “Adult count for Veg should
not be a negative number in <<locale>>”

 Rule: Kids count for Veg should not be a negative number.


 Message: Kids count for Veg should not be a negative number in <<locale>>
o If the validation fails, UI should display the error message - “Kids count for Veg should
not be a negative number in <<locale>>”
 Rule: Adult count for NonVeg should not be a negative number.
 Message: Adult count for NonVeg should not be a negative number in <<locale>>
o If the validation fails, UI should display the error message - “Adult count for NonVeg
should not be a negative number in <<locale>>”

 Rule: Kids count for NonVeg should not be a negative number.


 Message: Kids count for NonVeg should not be a negative number in <<locale>>
o If the validation fails, UI should display the error message - “Kids count for NonVeg
should not be a negative number in <<locale>>”
 Note: The messages have to be retrieved from the appropriate properties file. The Property file
has been given as part of code skeleton. Do not change/modify the property file

2.2 Control Flow


 By giving the request /showPage from the browser (Eg: http://localhost:8080/showPage), the
user should be redirected to the Bill Generation page which is showpage.jsp
 User will enter the customer name, contact number, choose the hall type and enter adult and kids
counts for both veg and non-veg categories.
 On clicking CalculateCost button, customer name, contact number, and the adult and kids
counts for both veg and non-veg categories should be validated as per the business rules &
validations.
 The total bill amount should be calculated and displayed in the page billdesk.jsp

2.3 Business Rules


 The Price chart is fixed for the Adults and Kids (5-9 years) under vegetarian and non-vegetarian
categories.
Cost for each category (in
Categories Rs.)
Adult Kids
Vegetarian 599 249
Non- 699 349
vegetarian

 For example:
 If the hall Type is AC then, extra Rs.500 has to be added to the total bill amount,
 adultVegCount = 2, kidsVegCount=0, adultNonVegCount = 3, kidsNonVegCount = 1, hallType
=”AC”
 totalCost = (2 * 599.0 + 0 + 3 * 699.0 + 1 * 349.0 ) + 500.0 = (1198.0 + 0.0 + 2097.0 +349.0)
+500.0 and
 totalCost = totalCost + 500.0 = 3644.0 + 500.0 = 4144.0
 Calculate the total Bill amount and display the same in billdesk.jsp.

3.0 Component Specification


3.0.1 Controller
 The BookController should be configured via annotation as a Controller
BillController
Attribute Attribute Type Access Specifier Constraints
Name
bookServic BookService private Use annotation to
e autowire

Method Name Method Argument Return type RequestMapping


name:type URL & Request
Method
showPage modelAttribute String /showPage & GET
“book”:
BookRestaurant
calculateTotalCos modelAttribute String /billDesk & POST
t “book”:
BookRestaurant,
result:BindingResult
, model:ModelMap
populateHallType Map<String, Should be annotated
String> with ModelAttribute
with name “hallList”

 Inside the populateHallType method you should add all the 2-hall type into the Map and return
the Map.
 BookService class should be autowired inside the Controller via annotations
 calculateTotalCost method in BookService class must calculate the total Bill amount based on
the hallType and the number of persons count provided by the user.

3.0.2 Service
 BookService class should be configured via annotation as Service

Method Name Method Argument Return type Responsibilities


name:type
calculateTotalCos “book”: double This method should
t BookRestaurant calculate the
totalCost based on
the hall type and
number of persons.

3.0.3 Model

Class(Model) Property Methods


BookRestauran customerName : String //getters and setters
t contactNumber : String
hallType : String
adultVegCount: int
kidsVegCount : int
adultNonVegCount : int
kidsNonVegCount : int
 Include the needed annotations inside the BookRestaurant Entity class for various validations
already mentioned. The error messages should be retrieved from the properties file

3.0.4 Internationalization
 Override the methods in InternationalizationConfig class provided as part of the code skeleton
to support Internationalization.
 Note: For the LocaleChangeInterceptor, to internationalize the page based on the new Locale,
use the parameter "language".
 Hint: Request from the UI (showpage.jsp) for all the three hyperlinks have language parameter
added to a request. Do not modify/change the hyper link /the values already provided as part of
the code skeleton in the showpage.jsp

3.1 Request Mapping Tasks

/showPage Redirect the user to showpage.jsp

/billDesk Should invoke calculateTotalCost method of the Controller after


submitting all the valid Booking details from showpage.jsp,
which in turn should invoke the calculateTotalCost method of
the BookService and redirect to billdesk.jsp with the appropriate
values depicted in the screen design. If there are validation
errors it should be redirected to showpage.jsp page

4.0 Overall Design Constraints


1) Implement the code using the best design standards.
2) Use Internationalization for all the labels and messages in the Bill Generation page.
3) Bill Generation page should support Internationalization for three languages English,
German and French. The error messages and the labels should be displayed from the
properties file depending on the locale. The properties file is already provided as part of
the code skeleton.
4) Spring Validator should be used for all the Validations. Use only annotation for performing
the validations.
5) BuffetRestaurantApplication which is the main class is already provided as part of the
code skeleton with the required annotations to auto scans the Controller, Service and
model classes. Do not modify/change the values already provided as part of the code
skeleton
6) Do not change the property name given in the application.properties files, you can
change the value and you can include additional property if needed.
7) In the pom.xml you are provided with all the dependencies needed for developing the
application.
8) You will not be evaluated based on the UI design (layout, color, formatting, etc.). You are
free to have a basic UI with all the required UI components (input fields, buttons, labels,
etc.). Expected components with the id alone should be designed as per the requirement.
9) Adhere to the design specifications mentioned in the case study.
10) Do not change or delete the class/method names or return types which are provided to you
as a part of the base code skeleton.
11) Also do not change the name or id of the HTML component which are provided to you as a
part of the base code skeleton.
12) Please make sure that your code does not have any compilation errors while
submitting your case study solution.

You might also like