Background You are tasked with creating a system (store) that manages the ordering and delivery of cakes, as well as stock management. The system is menu driven. And the user can choose too Add Order Dispatch Vehicle Add Delivery Vehicle

You are tasked with creating a system (store) that manages the ordering and delivery of cakes, as well as stock management.

The system is menu driven. And the user can choose too:
Add Order Dispatch Vehicle
Add Delivery Vehicle
Add Delivery Driver to Vehicle Order Stock
Display Stock
Display Cakes from Order Display Delivery Vehicle Display Total Number of Orders

The cakes are loaded into the system from a file at the start of running the program, and can not be changed once loaded.
A cake consists of its name, and quantity of each of its ingredients (eggs, sugar, flour and milk) An order consists of up to 10 cakes and an address to deliver the cake too.
A delivery vehicle can carry up to max orders, it has an id and a driver. The driver must be added after adding vehicle to the system.
A driver has a name.
A cake store sells N cake, 1 delivery vehicle and quantity of the total ingredients (eggs, sugar, flour and milk)

When an order is added, a delivery vehicle must exist (but not a driver). An order can only have one cake and the ingredients must be available from the total.
A vehicle can only be dispatched if there is at least 1 order, the delivery vehicle exist, and driver is added.

Create each class following the UML diagram, descriptions and tests.

A test class is provided for you to test two of the classes as you develop.
If the entire program does not work, a similar version will be used for marking.
Hence it is VERY important to get each working individual before proceeding to the next to maximize potential marks and feedback.

It is recommended you add to the tests provided or create your own tests, to cover all possible scenarios.

You must use the attributes and methods provided in the UML diagrams and base template You can add private helper methods if you want to any class

Class 1 –

– String name
+ Driver(String name)
+ String getName()
+ String toString()


Driver constructor
Initializes name attribute based on value passed

Accessor for name attribute

Returns String description of object

(Format as shown in DriverTester class)

Test class

Compile and Run,

The expected values should match the actual values.

Class 2 –

– String name
– int eggs
– int sugarGrams
– int flourGrams
– int milkMilliLitres
+ Cake(String name, int eggs, int sugarGrams, int flourGrams, int milkMilliLitres)
+ String getName()
+ int getEggs()
+ int getSugarGrams()
+ int getFlourGrams()
+ int getMilkMilliLitres()
+ String toString()


Cake constructor
Initializes attributes based on value passed

getName, getEggs, getSugarGrams, getFlourGrams, getMilkMilliLitres
Accessors for specified attributes

Returns String description of object

(Format as shown in CakeTester class)

Test class

Compile and Run,

The expected values should match the actual values.

Class 3 –

– int orderNumber
– String orderAddress
– int numberOfCakes
– static int totalNumOfOrders = 0
– Cake[ ] cake
+ static final int MAX_NUM_OF_CAKES = 10
+ Order(String orderAddress, Cake[ ] cakes, int numberOfCakes)
+ int getOrderNumber()
+ String getOrderAddress()
+ int getNumberOfCakes()
+ Cake[ ] getCakes()
+ static int getTotalNumOfOrders()
+ String toString()

Static Attribute

This static attribute (class attribute) tracks the total number of orders.
(Make sure to read the lectures how to use this, very important knowledge)


Order constructor
Initializes orderAddress, cakes and numberOfCakes based on the values passed Increment totalNumOfOrders
Set the orderNumber to the value totalNumOfOrders

getOrderNumber, getOrderAddress, getNumberOfCakes
Accessors for specified attributes

Static accessor (class accessor) for the static attribute totalNumOfOrders (Make sure to read the lectures how to use this very important knowledge)

Accessor for cakes
This needs to be done with no memory leaks for full marks

Returns String description of object

(Format as shown in Example Output)

Class 4 –

Write a tester to test ALL public methods in your class

Class 5 –

– int vehicleID
– Driver driver
– Order[ ] orders
– int maxOrdersOnBoard
– int numOrdersOnBoard
– int numOrdersDelivered
+ DeliveryVehicle(int vehicleID, int maxOrdersOnBoard)
+ boolean hasDriver()
+ void setDriver(Driver driver)
+ int getVehicleID()
+ int getNumOrdersDelievered()
+ int getNumOrdersOnBoard()
+ int getMaxOrdersOnBoard()
+ Order getOrder(int index)
+ void addOrder(Order order)
+ String makeDelivery()
– void updateDeliveredOrders()
+ String toString()
Order constructor
Initializes vehicle id based on value passed Set driver to null
Set maxOrdersOnBoard based on value passed
Set numOrdersDelivered and numOrdersOnBoard to 0 Create the array orders of length maxOrdersOnBoard

Returns true if driver is not null and false if driver is null

Mutator for driver attribute

getNumOrdersDelievered, getNumOrdersOnBoard, getMaxOrdersOnBoard, getVehicleID
Accessors for specified attributes

You need to develop this yourself

Adds an order based on value passed if there is room in the array. The orders array is filled from start to end
The number of orders on board is incremented when an order is added

updateDeliveredOrders (NOTE: This method is private)
Increment the numOrdersDelivered by the number of orders on board Set all orders to null
(You need to add more to this, using your knowledge of the problem)

Store the deliveryTicket by calling the toString method Call the updateDeliveredOrders
return the deliveryTicket

Returns String description of object
(Format as shown in Example Output)

Class 6 –
Write a tester to test ALL public methods in your class
Class 5 –

– Scanner keyboard
– DeliveryVehicle deliveryVehicle
– int totalEggs
– int totalSugarGrams
– int totalFlourGrams
– int totalMilkMilliLitres
– Cake[ ] cakes
– int numOfCakes;
+ static void main(String[] args)
+ CakeStore()
+ void run()
– void displayMenu()
– void process(int choice)
– boolean loadCakesFromFile()
– void addOrder()
– void printCakeMenu()
– void dispatchVehicle()
– void addDeliveryVehicle()
– void addDeliveryDriverToVehicle()
– void orderStock()
– void displayStock()
– void displayCakesFromOrder()
– void displayDeliveryVehicle()
– void displayTotalNumberOfOrders()
NOTE: There is NO displayCakes method in this assignment, instead there is displayCakesFromOrder

*Methods provided fully with code must not be changed, except where explicitly stated.

main (provided)
Creates an instance of the CakeStore
Prints student information (Edit to your own information) and program name
Calls the run method

CakeStore constructor (provided) Initializes attributes


Calls the method to load cakes from file Calls the method to display menu
Gets users input
Calls the method to process the users input

Displays the menu options

process (provided)
Calls the appropriate method based on the value passed

Ask and store the name of the cake file If the file exists
The first line of the file contains the number of cakes, read this and store in the attribute numOfCakes Create an array of Cakes of length numOfCakes, and store the reference in the attribute cakes Iterate through each cake in the file using a for loop
Store the cakes name, num of eggs, sugar grams, flour grams and milk millilitres Add each cake to the array using the information read
Return true if the file exists, else false

Use the example input files to help (They are all different lengths)

if delivery vehicle is null print “No delivery vehicle”
Else if delivery vehicle has max orders on board print “Delivery vehicle already full” Else
Set a variable to count the number of cakes in the order to 0
Create an array of Cake s for the order of the size of max number of cakes
(Use the Order class attribute) (Be careful, you are dealing with two arrays of Cakes now) do – while(more orders are required && number of cakes in the order is less than the max
Print the cake menu (use printCakeMenu() method) Ask the user for the cake
If the user enters an invalid cake print an appropriate message Else
Create a Cake object reference
Set the selected cake (from the cakes attribute) to this object reference
If there is not enough yeast, flour, cheese or tomato paste to make the cake print an appropriate message
Subtract the eggs, sugar, flour and milk from the totals Add the selected cake to the array of cakes for the order
Ask the user if they would like to add another cake

If at least one cake has been added to the order
Create a new order and add the order to the delivery vehicle Print a message that the Order has been added

Print the cakes names numbering from 0 See example output.

Write the method based on the following:
A vehicle can only be dispatched if it exist (not null), has a driver, and the number of orders on board is not 0. Print a message if the vehicle cannot be dispatched.
When a vehicle is dispatched the makeDelivery method is called and the details of the delivery are printed. (Hint: Use the String returned from makeDelivery)

If delivery vehicle is not null, print a message stating that a vehicle is already added Else
Ask the user for the vehicle id and store, Create a new delivery vehicle instance
Print a message to indicate that the delivery vehicle has been added

Write the method based on the following:
A driver can only be added if a vehicle exists and there is no current driver. Print a message if the driver cannot be added.


This method firstly displays the current stock level, use the displayStock method Then asks the user for each ingredient and adds to the total (see example)

Displays the total stock (eggs, sugar, flour and milk)

Display the cakes, from a particular order
Display invalid message if: No delivery vehicle, invalid order number or if order is empty Ask the user for the order number, and then display all the cakes from that order

Display the delivery vehicle using the toString in the DeliveryVehicle class

Display the total number of orders using the static getTotalNumOfOrders method in the Order class, this should work even when there are no orders.

Test run
A test run is provided that can be used to compare output

Calculate your paper price
Pages (550 words)
Approximate price: -

Quality Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.


Qualified Writers

We have hired a team of professional writers experienced in academic and business writing. Most of them are native speakers and PhD holders able to take care of any assignment you need help with.


Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account.


Prompt Delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. We will always strive to deliver on time.


Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text.


24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done


Place your order

Fill in the order form and provide all details of your assignment.


Proceed with the payment

Choose the payment system that suits you most.


Receive the final file

Once your paper is ready, we will email it to you.

Academic Writing Services

If you are looking for exceptional academic writing services, then you are in the right place. Studyacer offers customised academic assignments and academic papers for students at all levels.

StudyAcer StudyAcer


Essay Writing Help

Writing an essay can be a challenge. However, we know what every student needs. And we purpose to deliver. Here at StudyAcer, we do all we can to help with academic essays and assignments. We have a dedicated team of professional essay writers.

StudyAcer StudyAcer


Assignment Help

We understand students need satisfactory results. Our cheap assignment writing service helps and never leaves any doubt. We always strive to ensure the ultimate and best results. It is our joy to offer a cheap reliable essay writing service.

StudyAcer StudyAcer

Term paper

Term Paper Help

Have you been asking yourself, where can get a pre written research papers for sale? Worry no more, the fact that you have a term paper that is due tonight and you haven’t touched it. At Study Acer it is our responsibility to get your paper on time.

StudyAcer StudyAcer


Dissertation Writing Service

Several master’s students seek professional help with their thesis.Students from different parts of the world experience different challenges. Dissertations have different stages and the challenges are different too. Do not struggle in silence, order now .