Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Order class has private data for String customer name, String street address, String city, and integer number of refrigerators. It offers a default constructor,

The Order class has private data for String customer name, String street address, String city, and integer number of refrigerators. It offers a default constructor, parameterized constructor, accessors, and mutators. This source code file Orders.java is available for your use.
The Truck class with private data for String license number, String city, integer total number of refrigerators loaded, and a Java Stack of Order. The refrigerators are loaded into the truck in LIFO order, so the last order loaded is the first order delivered. It offers a default constructor, parameterized constructor, accessors, and mutators. The isFull method returns the full status of the truck. A truck has a limit of 6 refrigerators. This source code file Truck.java is partially developed for your use.
Add a boolean addOrder that is passed an order. It adds the order to the truck's stack and returns true if successful and returns false if the order cannot be loaded. All the refrigerators for the order must fit onto the truck to be successful.
Input:
File TodayOrders.txt contains a number of orders. Each order has a customer name, street address, town, and number of refrigerators. It is not known how many orders are listed. All orders are going to one of three cities: Portland, Lewiston, or Bangor.
Processing:
Declare 3 Truck objects, one going to Portland, one to Lewiston, and one to Bangor. Set the license number as desired. The trucks are initially empty.
Iterate over the data from the file and place each order into its truck. Since a truck can store only 6 refrigerators, store orders that cannot be delivered on an ArrayList of Order.
Write a display method that is passed a Truck object and report the delivery schedule for that truck. Note the LIFO delivery schedule as the last order loaded into the truck is the first order unloaded. Report the pending orders. See sample output.
1
Sample Output:
\table[[Prders to Portland,,],[Customer,Street Address,Refrigerators],[Ting Variety,700 Raskall Dr,2],[Masters Meats,39 Congress St.,3],[Hanley Nursing Home,125 Main St.,1],[,,],[orders to Lewiston,,Refrigerators],[Customer,Street Address,1],[Frenchs Funeral Home,50 Illuson Way,2],[Jetson Livery,5 State Way,1],[Billiards Grocery,23 Broadway,],[,,],[Orders to Bangor,,],[Customer,Street Address,1],[Astro Insurance,112 Helsinki Way,1],[Mainway Grocers,1000 Sedwick Rd,3],[Babcock Grocers,1 Hiddleton St,],[Lakeside Dermatology,46 Lakeview Dr.,],[,,],[Pending Orders,,],[Nana's Day Care,Portland,],[Carterfield Cafe,Bangor,]]
Grading Rubric:
The program is not accepted if the Stack class is not used.
The program is not accepted if class level variables are used in the main application.
The program is not accepted with use of break, continue, or goto statements to jump out of loops or use of infinite loops (while (true)).
The program is not accepted if it does not compile. Please make an appointment with the instructor for help as needed.
Input:
TodayOrders.txt contains a number of orders Each order has a customer name, street address, town, and number of refrigerators. It is not known how many orders are listed. All orders are going to one of three cities: Portland, Lewiston, or Bangor.
* TodayOrders.txt " Hanley Nursing Home
125 Main St.
Portland
1
Billiards Grocery
23 Broadway
Lewiston
1
Lakeside Dermatology
46 Lakeview Dr.
Bangor
3
Masters Meats
39 Congress St.
Portland
3
Jetson Livery
5 State Way
Lewiston
2
Babcock Grocers
1 Hiddleton St
Bangor
1
French's Funeral Home
50 Illuson Way
Lewiston
1
Ting Variety
700 Raskall Dr
Portland
2
Mainway Grocers
1000 Sedwick Rd
Bangor
1
Nana's Day Care
34 Fulsom Lane
Portland
2
Astro Insurance
112 Helsinki Way
Bangor
1
Carterfield Cafe
100 Elk Park
Bangor
2
"
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago