All Questions
19 questions
0
votes
3
answers
180
views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
10
votes
6
answers
5k
views
Conway's Game of Life Object oriented implementation in Java
I have designed Conway's Game of Life in Java, the solution follows Object Oriented design and paradigm, please review and let me know the feedback
Class Cell
Cell ...
1
vote
1
answer
482
views
Model animals using inheritance in Java
I was assigned the following problem:
You've gone back in time to 500BC Athens and Socrates wants you
to build him an app to help classify animals.
Build the classes ...
2
votes
1
answer
1k
views
Modelling a Call Center in Java (multithreading approach)
I wanted to give a shot to Modelling a Call Center from Cracking the Coding Interview. The problem statement is as follows:
You have a call center with three levels of employees: Respondent, Manager,...
3
votes
2
answers
194
views
Design a sustainable home tracker and calibrater for power, water, gas to minimize the expense
Problem Statement
Following are the various scenarios to be considered
Track energy - Track consumption of water, gas and electricity. We should be able extend to capture other type of ...
4
votes
1
answer
5k
views
A tax calculator application to calculate tax and print final receipt
Although this question has been asked a lot of times, I was hoping for a feedback on my approach.
Tax Calculator Basic sales tax is applicable at a rate of 10% on all
goods, except books, food, ...
6
votes
3
answers
3k
views
Reverse Polish Notation calculator with unit tests
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours.
Task was programming Reverse Polish ...
1
vote
2
answers
2k
views
Given points on a 2D plane, find line that passes through the most points
Could someone give some feedbacks from perspective of oo design and coding style on the following codes:
Question: Given n points on a 2D plane, find the Line with maximum number of points that lie ...
5
votes
2
answers
2k
views
Counting unique words, numbers, or phrases
I was given the below scenario to write a java program by a Software company. I did my best and was well tested as well. They came back rejecting my application without giving any review comments. I ...
14
votes
2
answers
28k
views
Elevator design (interview)
I believe interviews (~1 hour) commonly ask to code an elevator system, so this is my attempt.
I made some requirements/assumptions:
support one or more elevators
accept pickup requests (think of up/...
3
votes
2
answers
5k
views
Designing a call center in object oriented way
Description:
Below is one of the interview practice question. I think questions like these are to test the candidate's capability to write object oriented code. I being a candidate right now don't ...
7
votes
2
answers
209
views
Load and analyze a list of people from a file
I recently completed a programming task in Java for a job that was javascript heavy but the hiring company wanted some Java knowledge. I've been using Java since the turn of the year. Other than ...
6
votes
3
answers
6k
views
Football game using factory and command patterns
I'm really confused about the interview I did with a firm. They told my code was not expert, but almost intermediate level java.
Requirements
Football Scoring Dashboard
Develop an application that ...
8
votes
1
answer
1k
views
Designing yet another coffee machine, Lombok style
After reading Designing a coffee machine, I decided to implement the same problem as an exercise to get to know Guava and Lombok.
I used the problem statement from the given question:
Design a coffee ...
4
votes
4
answers
1k
views
Find Kth largest element in an array
I am preparing for interviews where my code would be judged based on optimizations, OOP concepts, code readability as well as my knowledge of JAVA and design patterns.
What comments will you give in ...