Sie sind auf Seite 1von 9

Assessment 2: Java Programming case studies

Contents
Introduction: ...................................................................................................................................................... 2
Q1. Specify Use cases (minimum of six) for the design of Country Kitchen Classics Web User Interface
specifying the actors. Provide possible scenarios (minimum of two) for each Use case. (Use UML notation) 2
Q2. Determine the classes that are required for the design (minimum of four classes). All classes need to
be given a meaningful name. ............................................................................................................................ 5
Q3. Assign attributes for the classes specifying the datatype, the possible range of values (meaningful
names should be given). .................................................................................................................................... 5
Q4. Provide the class declaration for three of the classes and a simple implementation of initialization of
datatypes of the classes. And provide a display() method that outputs the datatypes to the console. .......... 7
References ......................................................................................................................................................... 9

List of Figures
Figure 1 Country Kitchen: Use Case diagram .................................................................................................... 4
Figure 2 Class diagram ....................................................................................................................................... 7

1|Page
Introduction:
The country kitchen system helps the Business owners Alice and her business partner Rachel to expand their
business by selling frozen gourmet meals over the internet to old age and working family. The customers can
buy their favourite meals and can get delivered at their door steps. As a software developer, the required
task is to extend the classic database of country kitchen system and provide functionality to customers,
shipping manager and business owners. The following report is divided into 4 sections. Each section answer
each of the required question.

Q1. Specify Use cases (minimum of six) for the design of Country Kitchen
Classics Web User Interface specifying the actors. Provide possible
scenarios (minimum of two) for each Use case. (Use UML notation)
Three different actors are identified in the system. Out of all uses cases of the system, seven high level use
cases are presented below. They are shown using UML use case diagram. The UML notation [1] helps to
understand the system design and types of actions performed by the different actors of the system.

Use case Actor Scenario 1 Scenario 2


Customer registration Customer User fill-in registration User fill-in registration
details (Name, Address, details (Name, Address,
Email, Telephone Email, Telephone
Number, Credit card no) Number, Credit card no)
-> registration -> Error in details ->
successful. registration
unsuccessful
View meal options Customer Login to website -> Login to website ->
search required meal -> search required meal ->
meals not available required meal and
options available
Place order Customer Login to website -> Login to website ->
search required food -> search required food ->
required product required product
available -> select available -> select
products -> enter products -> enter
quantity -> order quantity -> quantity not
successfully placed available -> order
unsuccessful

2|Page
Track ordered meal Customer Login to website -> Login to website ->
enter order id -> check enter order id -> check
order status -> status order status -> status
displayed not prepared -> status
not displayed
Inquire meal details Customer Call country kitchen -> Call country kitchen ->
inquire meal options -> inquire meal option ->
meal available -> get meal not available ->
meal option response inquiry unsuccessful
Search meal database Staff member Receive call from Receive call from
customer -> browse customer -> browse
meal database -> item meal database -> item
present in database -> present in database ->
successful response to required quantity not
customer available -> response
unsuccessful
Order analysis Business owner Login to system -> order Login to system ->
details by date -> order orders by delivery type -
displayed > order displayed
Table 1 System use cases, actors and use case scenario

3|Page
Figure 1 Country Kitchen: Use Case diagram

4|Page
Q2. Determine the classes that are required for the design (minimum of
four classes). All classes need to be given a meaningful name.
After elementary analysis, we have found four classes required for proper functioning of the system. The
class name and description is mentioned in the below table 2.

Class name Class description


Customer Customer class stores the information of each
customer present in the country kitchen database.
Meals Meals class stores information of each meal offered
by the country kitchen to the customers.
Order Order class stores the details of each order placed
by customer to purchase the meal.
Application Application class triggers the execution of the
system and it is the main class from where the
application starts the execution.
Table 2 Class name and description

Q3. Assign attributes for the classes specifying the datatype, the possible
range of values (meaningful names should be given).
For each of the identified classes, the below table shows the data members, data type and possible range of
values for each of the identified type.

Class Name Attributes Datatypes Range

-2,147,483,648 to 2,147,483,647
c_id int
(4 bytes)
Max length:2147483647
c_name String
(4 bytes)
Max length:2147483647
c_address String
(4 bytes)
Max length:2147483647
c_email String
(4 bytes)
-2,147,483,648 to 2,147,483,647
c_telno int
Customer (4 bytes)

c_creditcard int -2,147,483,648 to 2,147,483,647


(4 bytes)

5|Page
m_id int -2,147,483,648 to 2,147,483,647
(4 bytes)

m_name String Max length:2147483647


(4 bytes)

m_desc String Max length:2147483647


(4 bytes)
Meals
price float approximately 3.40282347E+38F
(4 bytes)

o_id int -2,147,483,648 to 2,147,483,647


(4 bytes)

quantity int -2,147,483,648 to 2,147,483,647


(4 bytes)

c_id int -2,147,483,648 to 2,147,483,647

(4 bytes)
-2,147,483,648 to 2,147,483,647
m_id int
Order (4 bytes)
true or false
shipping_overnight boolean

Table 3 Class data members, data types and possible values

To present the simplified version of the above table, a class diagram is presented below. The class diagram
shows the classes which are required to build the system with their elements and different methods to
implement the system.

6|Page
Figure 2 Class diagram

Q4. Provide the class declaration for three of the classes and a simple
implementation of initialization of datatypes of the classes. And
provide a display() method that outputs the datatypes to the
console.
Here is the class declaration for each of the identified class and display method that displays the type of
data for each class attribute of the class [2].

Class Customer:

package c_kitchen;
public class Customer {
String c_name;
String c_email;
String c_address;
int c_id,telno,c_creditcard;
public Customer()
{
}
public Customer(String name, String email, String address, int c_id, int telno, int creditcard) {
this.c_name = name;
this.c_email = email;
this.c_address = address;
this.c_id = c_id;
this.telno = telno;

7|Page
this.c_creditcard = creditcard;
}
public void display(){
System.out.println("Type of c_name :"+c_name.getClass().getSimpleName());
System.out.println("Type of c_email :"+c_email.getClass().getSimpleName());
System.out.println("Type of c_address :"+c_address.getClass().getSimpleName());
System.out.println("Type of c_id :"+Integer.valueOf(c_id).getClass().getSimpleName());
System.out.println("Type of c_telno :"+Integer.valueOf(telno).getClass().getSimpleName());
System.out.println("Type of c_creditcard :"+Integer.valueOf(c_creditcard).getClass().getSimpleName());
}
}
Class Meal:

package c_kitchen;
public class Meals {
public int m_id;
public String m_name,m_desc;
float price;

public Meals(int m_id, String m_name, String m_desc, float price) {


this.m_id = m_id;
this.m_name = m_name;
this.m_desc = m_desc;
this.price = price;
}
public Meals()
{
}
public void display()
{
System.out.println("Type of c_name :"+m_name.getClass().getSimpleName());
System.out.println("Type of c_name :"+m_desc.getClass().getSimpleName());
System.out.println("Type of c_name :"+Integer.valueOf(m_id).getClass().getSimpleName());
System.out.println("Type of c_name :"+Float.valueOf(price).getClass().getSimpleName());
}
}
Class Order:
package c_kitchen;
public class order {
public int o_id, c_id ,m_id,quantity;
public String date;
boolean shipping_overnight;
public order()
{

}
public order(int o_id, int c_id, int m_id, int quantity, String date, boolean shipping_overnight) {
this.o_id = o_id;
this.c_id = c_id;
this.m_id = m_id;
this.quantity = quantity;
this.date = date;
this.shipping_overnight = shipping_overnight;

8|Page
}
public void display()
{
System.out.println("Type of M_id :"+Integer.valueOf(m_id).getClass().getSimpleName());
System.out.println("Type of c_id :"+Integer.valueOf(c_id).getClass().getSimpleName());
System.out.println("Type of o_id :"+Integer.valueOf(o_id).getClass().getSimpleName());
System.out.println("Type of quantity :"+Integer.valueOf(quantity).getClass().getSimpleName());
System.out.println("Type of Date :"+date.getClass().getSimpleName());
System.out.println("Type of shipping_overnight :"+
Boolean.valueOf(shipping_overnight).getClass().getSimpleName()); } }

References

[1] T. Quatrani, Visual modeling with Rational Rose 2000 and UML, Addison-Wesley Professional, 2000.

[2] H. Schildt, Java: the complete reference, McGraw-Hill Education Group, 2014.

9|Page

Das könnte Ihnen auch gefallen