NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Amazon is developing a new locker system for Amazon deliveries
to ensure customer packages are delivered in a secure location.

In order to assist delivery drivers, Amazon will develop a software to be installed
that will instruct which locker the driver should place the package in depending on its size.

For the purposes of this question, design and implement the component of this system
that will take a package's size and return the locker number the package should be
stored in so that the customer can be notified where their package is located.

This solution should be able to simulate adding a package to the locker
and removing a package given a locker number.

public class Facility
{
private List<Package> numOfSmallLockers;
private List<Package> numOfMidLockers;
private List<Package> numOfLargeLockers;

public Facility (int numOfSmall, int numOfMid, int numOfLarge)
{
numOfSmallLockers = new ArrayList<>(numOfSmall);
numOfMidLockers = new ArrayList<>(numOfMid);
numOfLargeLockers = new ArrayList<>(numOfLarge);
}

public List<Package> getNumOfSmallLockers()
{
return numOfSmallLockers;
}

public List<Package> getNumOfMidLockers()
{
return numOfMidLockers;
}

public List<Package> getNumOfLargeLockers()
{
return numOfLargeLockers;
}

// public void addPackage
}

public class Packages

{
private int[] lockerNum; // 1-10 11-20 21-30
private String packageSize ; // "S" "M" "L"
private int id;

public PackageLocker (int id,String size)
{
this.id = id;
this.packageSize = size;
}

public void setLockerNum(int lockerNum)
{
this.lockerNum = lockerNum;
}

public int getLockerNum()
{
return this.lockerNum;
}

public void setPackageSize(String packageSize)
{
this.packageSize = packageSize;
}

public int getLockerNum()
{
return this.packageSize;
}




}

// Facility facility = new Facility(10,10,10);
// Packages mediumP = new Packages(1,"M");
// ImplemnatationServiceClass impl = new ImplemnatationServiceClass();
// impl.addPackage(f,mediumP);

public class ImplemnatationServiceClass
{


public void addPackage(Facility f, Packages p)
{


if (p.getSize()=="S")
{
List<Package> tempList = f.getNumOfSmallLockers();
if (tempList!=null)
{

tempList.add(p);
}

}
if (p.getSize()=="M")
{
List<Package> tempList = f.getNumOfMediumLockers();
if (tempList!=null)
{

tempList.add(p);
}

}
if (p.getSize()=="L")
{
List<Package> tempList = f.getNumOfLargeLockers();
if (tempList!=null)
{

tempList.add(p);
}

}
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.