Anonymous
BAN USER- 1of 1 vote
AnswerFor each subject topic(like Maths,Physics,Java,Sql), I have some urls.
- Anonymous in India
In each url,I have a list of questions.
Now on each click(lets say Physics),I shall hit all urls(which could be in thousands) and then parse through them to get all the questions and persist them to DB.
Please tell me what can be the high levl and low level design for this in Java(Explain patterns that cn be used,Threads etc...)| Report Duplicate | Flag | PURGE
Akamai Java Developer Algorithm - 0of 0 votes
AnswersPhonebook contains number and name.
- Anonymous in India
1.use the java collection to add these entry (name and string).
2.Search the name by number
3.Remove the entry (name and string ) by using name.
I need to do this in Java...But if you can suggest me some Collection that can be used here, I shall do that....
I thought of :
1.using Hashmap,but here both name and number will be key....which wont be good...
2.Another option is to wrap both phone and number in an object and then add them to the list.And then Iterating and adding to the list.
Any other suggestions..?| Report Duplicate | Flag | PURGE
Accenture Software Engineer / Developer Java - 0of 0 votes
AnswersPrint below series in java
- Anonymous in India
*** 1***
**2 *2**
*3*3*3*
4*4*4*4| Report Duplicate | Flag | PURGE
Accenture Software Engineer / Developer Java - 0of 0 votes
AnswersThis was at a recent written test...
There is a toycar placed on a 5 by 5 board.We can give 5 commands to it ,
PLACE(X,Y,F) where x denotes X Axis,y denotes Y Axis and F denotes the direction to which its facing.
MOVE->Move will move the toycar one step in the direction where its facing
LEFT->Left will turn the toycar by 90 degrees to its left and face it to the new direction .Note:Left will not move the toycar, it will just change the direction
RIGHT->Right will turn the toycar by 90 degrees to its right and face it to the new direction .Note:Right will not move the toycar, it will just change the direction
REPORT->Report shall tell me the X Axis,YAxis and Direction of the toycar. like 0,0,NORTH
Note:You cannot move,left,right,report the toycar unless you place it.
Assume its a Prod level code, Solve it in Java only.
Below is my code and I haven't been selected, please tell me if there is better way to do it because my solution is correct but probably very basic.Thanks.
- Anonymous in Indiapackage com.ds; public class ToyCar { private ToyCar toycar; private boolean isToyPlaced; private int xAxis,yAxis; private enum Direction {EAST,WEST,NORTH,SOUTH}; private Direction direction; public int getxAxis() { return xAxis; } public void setxAxis(int xAxis) { this.xAxis = xAxis; } public int getyAxis() { return yAxis; } public void setyAxis(int yAxis) { this.yAxis = yAxis; } public Direction getDirection() { return direction; } public void setDirection(Direction direction) { this.direction = direction; } ToyCar(){ } public ToyCar(int xAxis,int yAxis,Direction direction) { this.xAxis=xAxis; this.yAxis=yAxis; this.direction=direction; } public void place(int x,int y, Direction d){ if(x<0||x>5||y<0||y>5 || d==null){ System.out.println("Place Error:Attempt to place toy outside the box"); return; } toycar = new ToyCar(x, y, d); isToyPlaced=true; } public void move(){ if(!isToyPlaced){ System.out.println("Move Error:Attempt to Move Toy without placing in board"); return; } if(toycar.getDirection().equals(Direction.EAST)){ int newPosition=toycar.getxAxis()+1; if(newPosition<0||newPosition>5){ System.out.println("Move Error:Attempt to place toy outside the box"); return; } toycar.setxAxis(newPosition); }else if(toycar.getDirection().equals(Direction.WEST)){ int newPosition=toycar.getxAxis()-1; if(newPosition<0||newPosition>5){ System.out.println("Move Error:Attempt to place toy outside the box"); return; } toycar.setxAxis(newPosition); }else if(toycar.getDirection().equals(Direction.NORTH)){ int newPosition=toycar.getyAxis()+1; if(newPosition<0||newPosition>5){ System.out.println("Move Error:Attempt to place toy outside the box"); return; } toycar.setyAxis(newPosition); }else if(toycar.getDirection().equals(Direction.SOUTH)){ int newPosition=toycar.getyAxis()-1; if(newPosition<0||newPosition>5){ System.out.println("Move Error:Attempt to place toy outside the box"); return; } toycar.setyAxis(newPosition); } } public void left(){ if(!isToyPlaced){ System.out.println("Left Error:Attempt to Move Toy without placing in board"); } if(toycar.getDirection().equals(Direction.EAST)){ toycar.setDirection(Direction.NORTH); } else if(toycar.getDirection().equals(Direction.WEST)){ toycar.setDirection(Direction.SOUTH); } else if(toycar.getDirection().equals(Direction.NORTH)){ toycar.setDirection(Direction.WEST); } else if(toycar.getDirection().equals(Direction.SOUTH)){ toycar.setDirection(Direction.EAST); } } public void right(){ if(!isToyPlaced){ System.out.println("Right Error:Attempt to Move Toy without placing in board"); } if(toycar.getDirection().equals(Direction.EAST)){ toycar.setDirection(Direction.SOUTH); } else if(toycar.getDirection().equals(Direction.WEST)){ toycar.setDirection(Direction.NORTH); } else if(toycar.getDirection().equals(Direction.NORTH)){ toycar.setDirection(Direction.EAST); } else if(toycar.getDirection().equals(Direction.SOUTH)){ toycar.setDirection(Direction.WEST); } } public void report(){ if(!isToyPlaced){ System.out.println("Report Error:How can i report when I am not on board"); return ; } System.out.println(toycar.getxAxis()+" , "+toycar.getyAxis()+" , "+toycar.getDirection()); } public static void main(String[] args){ ToyCar to = new ToyCar(); to.place(0, 0, Direction.WEST); to.left(); to.move(); to.report(); } }
| Report Duplicate | Flag | PURGE
CSC Java Developer Java
RepI am Risk managers that advise organizations on any potential risks to the profitability, safety, security or existence of the ...
Repcrystalblibby, Analyst at Achieve Internet
By professional i am teacher. Successfully supervised and assisted students, grade artwork, encouraged creativity and new technique.Familiar with art ...
Repmarierlewis2, AT&T Customer service email at ASAPInfosystemsPvtLtd
I am Marie and I live in Los Angeles USA, I have a strong base in marketing and I believe ...
RepEwaMariaa, Cloud Support Associate at Abs india pvt. ltd.
Hi, I am an Localization translator from New York,Travelling with company executives on foreign trips is the favorite part ...
Reprubyperezj, Backend Developer at A9
My name is Ruby Perez and I live in Lyndonville and it would be my honor and privilege to be ...
Repclairetsmith49, AT&T Customer service email at ADP
Hello, I am Claire and work as a Human resources and I am responsible for recruiting, screening, interviewing and how ...