Amazon Interview Question for Software Engineer / Developers


Team: Amazon Video
Country: UK
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
3
of 5 vote

class MemberShip {
public String Name;
public int Price;
}

class GoldMemberShip extends MemberShip {
}

class SilverMemberShip extends MemberShip {
}




public interface MemberShipManager {

public void subscribe(Vehcile v, MemberShip m);
public void unsubsribe(Vehcile v, MemberShip m);
}

public class ParkingMemberShipManger implements MemberShipManager {
ArrayList<String> subscribedVehicle;
public ParkingMemberShipManger(){
subscribedVehicle = new ArrayList<String>();
}
public void subsribe(Vehicle v, MemberShip m)
{
subscribedVehicle.add(v.no);
//rest of the code
}

public void unsubsribe(Vehcile v, MemberShip m) {
subscribedVehicle.remove(v.no);
//rest of the code
}
}

- Sunil June 24, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

class Vehcile {

int VehcileNumber;

public int getVehcileNumber() {
return VehcileNumber;
}

public void setVehcileNumber(int vehcileNumber) {
VehcileNumber = vehcileNumber;
}

}

class Row {

public static final int MAX_NO_OF_VEHCILE_IN_ROW = 10;

int noOfVehicleParked = 0;
List<Vehcile> listOfVehicalParked;

public int getNoOfVehicleParked() {
return this.noOfVehicleParked;
}

public List<Vehcile> getListOfVehicleParked() {
return this.listOfVehicalParked;
}

public synchronized void remove(Vehcile v) {
if (listOfVehicalParked.contains(v)) {
listOfVehicalParked.remove(v);
noOfVehicleParked--;
}
}

public synchronized void add(Vehcile v) {
listOfVehicalParked.add(v);
noOfVehicleParked++;
}
}

class Parking {

static final int MAX_NO_ROWS = 5;
Row[] parkingRows = new Row[MAX_NO_ROWS];

public synchronized void parkVehcile(Vehcile v) {
for (int i = 0; i < MAX_NO_ROWS; i++) {
Row parkingRow = parkingRows[i];
if (parkingRow.getNoOfVehicleParked() < Row.MAX_NO_OF_VEHCILE_IN_ROW) {
parkingRow.add(v);
break;
}
}
}

public void showRowCount() {
for(int i=0; i<MAX_NO_ROWS;i++) {
System.out.println(parkingRows[i].getNoOfVehicleParked());
}
}


}

- agr.kapill July 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

The membership class would be something like below.

class MemberShip {
public String Name;
public int Price;
}

class GoldMemberShip extends MemberShip {
}

class SilverMemberShip extends MemberShip {
}




public interface MemberShipManager {

public void subscribe(Vehcile v, MemberShip m);
public void unsubsribe(Vehcile v, MemberShip m);
}

public class ParkingMemberShipManger implements MemberShipManager {
ArrayList<String> subscribedVehicle;
public ParkingMemberShipManger(){
subscribedVehicle = new ArrayList<String>();
}
public void subsribe(Vehicle v, MemberShip m)
{
subscribedVehicle.add(v.no);
//rest of the code
}

public void unsubsribe(Vehcile v, MemberShip m) {
subscribedVehicle.remove(v.no);
//rest of the code
}
}

- Sunil June 24, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More