*We are done hiring. Visit us later.
If you are reading this, then you are interested in our company “megam ..” and(or) would have received an email from us.
Let me introduce our startup.
“megam ..” was founded by “Kishorekumar Neelamegam“, & “Deepa Arulraj” with focus on building “Cloud on Cloud” for the SaaS market to help businesses/SMB (Small and medium business) cut down spending on IT operations.
Kindly solve the following problems and send us the deliverables before the cutoff time as mentioned in my email to firstname.lastname@example.org (or) tweet @indykish.
Given an algebraic expression as illustrated in the examples below,
example 1: ax^3 + bx^2 + c
example 2:xyz + bx2 + cx + er + yu
example 3: (x+y)*z + 1 – 3/20 + r-9 + 0
example 4: 10/x
example 5: (a+c)*v
example 6: (((a+c)/10 – 2 *v^2))
- The alphabets shall be treated as variables. (In example 1, a, x, b, c are variables. )
- The expression shall support (+, -. *, /,^).
- ^ indicates power of.
- An expression like ax shall be interpreted implicitly as a*x.
- An expression like 5ax shall be interpreted as 5*a*x.
- The order of evaluation of arithmetic operator to be followed. Brackets are allowed as well. Brackets take precedence during the arithmetic evaluation of the expression. For instance in example 3, (x+y) needs to be evaluated first.
Write one program in Java or Ruby (or) C/C++ (or) python which allows entry of an algebraic expression via console or UI (user interface). Upon entry of the arithmetic expression the program to request input from the user to enter the value of the variables parsed and an arithmetic evaluation shall be performed by applying the input numeric values. Your program has to print the evaluated result. The program shall be generic and not limited to the above examples. For example this shall allow an user to enter any kind of expression (let us say a + bx, ay – c, mk/op+0 etc…). We are not looking at 6 programs which solve the examples only, if in case you send the same, you will be disqualified.
Hint : First come up with data structures for the above program
- Parse the input and figure out the alphabets, and ask for input from the user. Store them in a collection(STL in C++)/hashmap (collection(Java)/structure in C or any other means.
- Form groups to evaluate the expression. To do that use a method and run recursive method calls to that method and build groups based on the arithmetic order of evaluation(for instance * takes precedence to + (or) brackets to be evaluate than anything etc..). Store the groups and the operators that tie them together.
- Next is to apply values to those groups.
- Now use the evaluated groups and apply the arithmetic operators as you have saved to merge your evaluation.
Example scenario for program 1.
When an user enters ax^3 + bx^2 + c the program shall request the user to enter input for a,x,b,c.
Enter the expression to evaluate ?
ax^3 + bx^2 + c
Enter the input for a ?
Enter the input for b ?
Enter the input for c ?
Enter the input for x ?
The result of the expression ax^3 + bx^2 + c is (4*5)^3 + (8*5)^2 + 1 = 9601.
Kindly format the received profile information in a tabular format, followed by the likes information.
When you send the results, mask or hide the result/keys to ensure confidentiality of your profile info.
Hint use :http://developers.facebook.com/, more specifically this link => http://developers.facebook.com/docs/guides/web/#login
Please send us the following deliverables.
- Zipped code as you have created in an IDE (eclipse or netbeans, or any others).
- Automated unit testing is a plus using JUnit for Java (or) [Sinatra/RSpec/Cucumber..for Ruby] illustrating at least 5 positive test cases getting passed, and 5 test cases failing as it should.
- Screen shots of test results for problem 1, problem 2 illustrating at least 5 positive test cases getting passed, and 5 test cases failing as it should.
- Well documented code for both problems which explains the logic of implementation .
Test.. Test..Test.. before you send it. It is not writing code, but writing good code that works. Put yourself in the shoes of the user and ask the question “Would you buy a mobile, if the key pads don’t work ?”.
Please note that the prime factor during evaluation would be completeness of the program in terms of quality, automated unit test is a plus and code documentation.
Allow us a business day to get back to you on the results. Good luck .. Enjoy hacking.