Description A delivery company has two methods of delivery - ground vehicles and air drones. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Description A delivery company has two methods of delivery - ground vehicles and air drones. The delivery area is covered by a grid of roads stretching from north to south and from east to west every kilometer. A ground vehicle can move on the roads - along X axis or Y axis, whereas drone can fly directly to the destination. Both devices receive coordinates for delivery and relocate accordingly. The company keeps track of a total distance traveled to deliver all packages. Y 1,3 2,3 3, 3 H 1,2 2,2 3, 2 2,1 1, 1 3, 1 X Introduce an interface named Delivery to describe a delivery device with a method deliver To(int x, int y). The method would return the distance traveled from the last position of the vehicle or drone to delivery destination. Create two independent classes for ground and air delivery that implement the interface. The program should first accept a delivery type (either 'ground' or 'air') and a sequence of delivery destinations as a pair of coordinates terminated with the word 'end', for example: air 23 55 41 72 53 end The delivery starts from coordinates (0, 0) and then visits all the destinations in the sequence. Travel distance for vehicle is Travel distance for drone is Optimize the code and utilize the concept of polymorphism when using objects of either vehicle or drone. Create a custom exception class that should be thrown in case an invalid delivery type is entered. The program should handle all the exceptions (none thrown by the main method), including those resulting from incorrect user's input of non-numerical coordinates. The program should print out the total distance traveled on the delivery route. Description A delivery company has two methods of delivery - ground vehicles and air drones. The delivery area is covered by a grid of roads stretching from north to south and from east to west every kilometer. A ground vehicle can move on the roads - along X axis or Y axis, whereas drone can fly directly to the destination. Both devices receive coordinates for delivery and relocate accordingly. The company keeps track of a total distance traveled to deliver all packages. Y 1,3 2,3 3, 3 H 1,2 2,2 3, 2 2,1 1, 1 3, 1 X Introduce an interface named Delivery to describe a delivery device with a method deliver To(int x, int y). The method would return the distance traveled from the last position of the vehicle or drone to delivery destination. Create two independent classes for ground and air delivery that implement the interface. The program should first accept a delivery type (either 'ground' or 'air') and a sequence of delivery destinations as a pair of coordinates terminated with the word 'end', for example: air 23 55 41 72 53 end The delivery starts from coordinates (0, 0) and then visits all the destinations in the sequence. Travel distance for vehicle is Travel distance for drone is Optimize the code and utilize the concept of polymorphism when using objects of either vehicle or drone. Create a custom exception class that should be thrown in case an invalid delivery type is entered. The program should handle all the exceptions (none thrown by the main method), including those resulting from incorrect user's input of non-numerical coordinates. The program should print out the total distance traveled on the delivery route.
Expert Answer:
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these programming questions
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
A score of X = 75 is measured in a population with a mean of = 100. A z-score of z = +1.50 is calculated. Without knowing the standard deviation, explain why the z-score of z = +1.50 is incorrect.
-
How important is the Chinese market to Starbucks? Does the presence of look-alike companies like Xing Ba Ke deter firms from entering the market?
-
If an object is acted on by a single constant force, is it possible for the object to remain at rest? Is it possible for the object to move with constant velocity? Is it possible for the objects...
-
List three ways to get input from the console and convert that input to the desired data type.
-
During 2012, Walnut Company completed the following two transactions. The annual accounting period ends December 31. a. Paid and recorded wages of $130,000 during 2012; however, at the end of...
-
The local theater company is choosing its next play. The company's members recently held a vote to decide which of three choices - Elektra, Tartuffe, and Hamlet - the company will perform. The...
-
Demand and inventory on hand for five SKUs are presented in Table 2: Given that the demands are deterministic and in manhours, and the available manhours (Pt) for a cycle is 3000, i. determine the...
-
Ten Rings Ltd is a small wholesale business selling premium jewellery boxes. The balance sheet at the end of December 2021 is shown below. (11) (111) (iv) (v) (vi) (vii) (viii) (ix) (xii) Assets...
-
Globe Industries' year-end is May 31. Based on an analysis of the unadjusted trial balance at May 31, 2023, the following information was available: a. Accrued revenue at year-end totaled $24,300 b....
-
Mel sells land that had been used in his business for $300,000. The land has an adjusted basis of $150,000. The buyer gives Mel a note for $150,000 and cash of $150,000. Mel receives no payment on...
-
A component arrives gradually and at the rate of 20 units per week and is used with the rate of 5 units per week. The item costs $2,000 per unit. The cost per order is $10,000 and the annual holding...
-
K Simplify the expression. (6x3y) (7xy-3) (6x3y2) (7xy-3)=(Simplify your answer. Use positive exponents only.)
-
What body oversees a board that develops ethics requirements for professional accountants globally?
-
3- If the temperature increased, what will happen about the dynamic viscosity? 4- What is the shortcoming of this method?
-
Anne is employed by Bradley Contracting Company. Bradley has a $1.3 million contract to build a small group of outbuildings in a national park. Anne alleges that Bradley Contracting has discriminated...
-
Ann Archer serves on the audit committee of JKB Communications, Inc., a telecommunications start-up company. The company is currently a private company. One of the audit committee's responsibilities...
-
Distinguish between the general audit objectives and management assertions. Why are the general audit objectives more useful to auditors?
-
Even though Bergeron Wholesale Company is privately held, management has decided that it is worthwhile to have effective internal controls to the extent it is practical in a small company, as a way...
-
Based on the historical record of surprises in inflation and productivity, the historical equity risk premium for the US equity market, if it is used as an estimate of the forward- looking equity...
-
Based upon Exhibit 1, the realized three-year holding period return for Novo-Gemini Inc. was closest to: A. 39.76%. B. 42.76%. C. 44.82%. Judy Chen is the primary portfolio manager of the global...
-
Based upon Exhibit 1, the expected three-year holding period return for Novo-Gemini Inc. at the time of purchase was closest to: A. 39.76%. B. 42.76%. C. 44.82%. Judy Chen is the primary portfolio...
Study smarter with the SolutionInn App