[Solved] CENG1004 Final Homework

Click And Check all our Assignments
Click Here and Upload you Assignment for Free!


100/100 Trustscore on scamadviser.com

10 USD $

Category: Tag:

Mugla Cafe needs an application to get orders from customers and print and calculate the price of these orders. Mugla Cafe Beverage prices are shown in the following table, note that price of beverage varies depending on its size. Furthermore, milk can be added to Cafein Beverages and lemon can be added to Tea Beverages with an extra cost of 1 Turkish Liras.

Latte 5 TL 6 TL 7 TL
Capucino 6 TL 7 TL 8 TL
Americano 7 TL 8 TL 9 TL
Black Tea 3 TL 4 TL 5 TL
Green Tea 4 TL 5 TL 6 TL
Linden Tea 5 TL 6 TL 7 TL

Following Class Diagram shows the relations between the classes. Order can contain one or more order items, order item contain a beverage and specifies the amount (how many) of beverage. Beverage has an inheritance hierarchy, important methods and attributes are shown.

Following Test class is given. Create the required classes and implement the necessary functionalities to make make the test class compilable so that it can generate the intended output. Your classes should reflect the design shown in the class diagram.

public class TestCafe {
public static void main(String args[]){/**
* A group of fiends ordered
* 2 Small-sized Latte with Milk* 2 Medium-sized Cappucino without Milk* 1 Large-sized Americano with Milk
* 3 Small-sized Black Tea without Lemon
* 1 Medium-sized Green Tea with Lemon* 1 Small-sized Linden Tea with Lemon*/
Order order = new Order();
CaffeineBeverage cBeverage = new Latte(true, Beverage.SMALL); order.add(new OrderItem(cBeverage, 2));cBeverage = new Cappucino(false, Beverage.MEDIUM);
order.add(new OrderItem(cBeverage, 2));
cBeverage = new Americano(true, Beverage.LARGE);order.add(new OrderItem(new Americano(), 1));TeaBeverage tBeverage = new BlackTea(false, Beverage.SMALL);
order.add(new OrderItem(tBeverage, 3));
tBeverage = new GreenTea(true,Beverage.MEDIUM); order.add(new OrderItem(tBeverage, 1)); tBeverage = new LindenTea(true,Beverage.SMALL);
order.add(new OrderItem(tBeverage, 1));
//print the order
//Expected output :// 2 Small Latte with Milk 12 TL// 2 Medium Cappucino without Milk 12 TL
// 1 Large Americano with Milk 10 TL
// 3 Small Black Tea without Lemon 9 TL// 1 Medium Green Tea with Lemon 6 TL// 1 Small Linden Tea with Lemon 6 TL // TOTAL : 55 TL


Give answers to the following questions in your documentation.

  1. What is an abstract class? Which class(es) can be defined as abstract class in your code?
  2. What is an abstract method? Which methods can be defined as abstract in your code?
  3. What is the difference between an Interface and Class? Can you use an Interface instead of a Class in your implementation? Explain why or why not?
  4. What is the difference between a static and non-static variable. Have you used any static variables in your implementation. If yes, give the name of the variables?
  5. Have you benefited from polymorphism in your implementation. If yes, copy the code segment where you use polymorphism to your report and give the name of the polymorphic variable.


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CENG1004 Final Homework
10 USD $