-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem.rtf
More file actions
73 lines (64 loc) · 3.72 KB
/
Problem.rtf
File metadata and controls
73 lines (64 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf820
{\fonttbl\f0\fswiss\fcharset0 ArialMT;\f1\froman\fcharset0 Times-Roman;}
{\colortbl;\red255\green255\blue255;\red43\green50\blue61;\red0\green0\blue0;}
{\*\expandedcolortbl;;\cssrgb\c22353\c25882\c30588;\cssrgb\c0\c0\c0;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
\margl1440\margr1440\vieww16460\viewh14600\viewkind0
\deftab720
\pard\pardeftab720\sl340\sa533\partightenfactor0
\f0\fs29\fsmilli14667 \cf2 \expnd0\expndtw0\kerning0
Write a Java application that will solve the problem below. Given inputs of
\i\b initial price
\i0\b0 ,
\i\b discount
\i0\b0 ,
\i\b floor price
\i0\b0 and
\i\b budget
\i0\b0 it should return the
\i\b number of books that can be purchased
\i0\b0 along with any
\i\b remaining money
\i0\b0 after the purchase. Put your code on Github and send a link to the repository. The README should include instructions for building, testing and running your application.
\f1\fs24 \cf3 \
\pard\pardeftab720\sl340\partightenfactor0
\f0\b\fs29\fsmilli14667 \cf3 \ul \ulc3 Please take the below points into account while creating this application:
\f1\b0\fs24 \ulnone \
\pard\tx220\tx720\pardeftab720\li720\fi-720\sl340\partightenfactor0
\ls1\ilvl0
\f0\fs29\fsmilli14667 \cf3 \kerning1\expnd0\expndtw0 {\listtext \'95 }\expnd0\expndtw0\kerning0
How easy will it be for a colleague to review, understand and fix a bug in your code?\uc0\u8232 \
\ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext \'95 }\expnd0\expndtw0\kerning0
How thorough is the test coverage and how would you measure it?\uc0\u8232 \
\ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext \'95 }\expnd0\expndtw0\kerning0
How would your application integrate and scale with other web services of a large online bookseller?\uc0\u8232 \
\ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext \'95 }\expnd0\expndtw0\kerning0
Are there additional optimizations in the code or test cases that you would like to handle but did not have time to implement?\uc0\u8232 \
\pard\pardeftab720\sl340\sa160\partightenfactor0
\b \cf3 \ul Problem
\f1\fs36 \ulnone \
\pard\pardeftab720\sl340\sa533\partightenfactor0
\f0\b0\fs29\fsmilli14667 \cf2 You wish to buy books from a famous bookstore
\f1\fs24 \cf3 \
\f0\fs29\fsmilli14667 \cf2 Usually, all books are sold at the same price, \'a0dollars. However, they are planning to have a sale for Halloween next month in which you can buy books at a cheaper rate. Specifically, the first book you buy during the sale will be sold at an
\i\b initial price
\i0\b0 of exactly
\i x
\i0 dollars, but every subsequent book you buy will be sold at a
\i\b discount
\i0\b0 of exactly
\i y
\i0 dollars less than the previous bought book\'92s cost. This will continue until the cost becomes less than or equal to a
\i\b floor price
\i0\b0 of z dollars, after which every book \'a0will cost you z dollars each.
\f1\fs24 \cf3 \
\f0\fs29\fsmilli14667 \cf2 Eg: Every book has an initial price of 50 dollars. Every subsequent book will be sold at a discount of \'a04 dollars less. This will continue till cost becomes less than or equal to the floor price of 25 dollars. The price of the books will be then decrease as follows:
\f1\fs24 \cf3 \
\f0\fs29\fsmilli14667 \cf2 50 46 42 38 34 30 26 25 25 25 25 25
\f1\fs24 \cf3 \
\f0\fs29\fsmilli14667 \cf2 Let\'92s say you have 300 dollars in your
\i\b budget
\i0\b0 . How many books can you buy during the sale?
\f1\fs24 \cf3 \
\f0\fs29\fsmilli14667 \cf2 Expected answer : 8 books, $9 remaining}