Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/get cheapest basic prices #77

Open
wants to merge 330 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
330 commits
Select commit Hold shift + click to select a range
a36732f
Merge branch 'feature/get-salary-averages-for-cities' of https://gith…
Feb 12, 2023
e4a3be9
call execute function from class getSalaryAverageForCitiesInCountryIn…
RehabFakhry Feb 12, 2023
d6ae000
Merge branch 'feature/get-salary-averages-for-cities' of https://gith…
Feb 12, 2023
d4b2d02
clean unnecessary named data type
ahmednasserzaza Feb 12, 2023
805ff2a
add GetSuitableCityMoreSavingPerMonthInteractor class
AzizaHelmy Feb 12, 2023
1dc79bc
add the test class
AzizaHelmy Feb 12, 2023
d6ae9de
add FakeData class for testing
AzizaHelmy Feb 12, 2023
8d2b391
correct warnings messages in test class
Feb 12, 2023
f7c4abe
add second test case for input full-time-salary-equal-zero
SaraSallah Feb 12, 2023
98f6723
add third test case for input negative-full-time-salary-
SaraSallah Feb 12, 2023
233bedc
add initial commit for first test case
AzizaHelmy Feb 12, 2023
6e1dd90
add the function for first test case
AzizaHelmy Feb 12, 2023
adf64e9
add top ten class and test class
ZeinabAbdien00 Feb 12, 2023
50643f1
add top ten class and test class
ZeinabAbdien00 Feb 12, 2023
1819d69
test size of list
ZeinabAbdien00 Feb 12, 2023
6e78f42
add test cases for excludeNullSalaries function
AzizaHelmy Feb 12, 2023
b2b32ca
add new test case in GetCheapestBananaCitiesNamesInteractorTest
ahmednasserzaza Feb 12, 2023
4ed8dd7
add test cases for excludeNullApartment3BedroomsInCityCenter function
AzizaHelmy Feb 12, 2023
19468b9
create Top10CitiesFruitsAndVegetablesLowestCostInteractor with a func…
ahmednasserzaza Feb 12, 2023
9197c4e
add test case for excludeNullFoodies function
AzizaHelmy Feb 12, 2023
c93e4ed
edit parameter in function execute which we may use in testing
ahmednasserzaza Feb 12, 2023
b75f1ef
add test cases for excludeNullFoodies function
AzizaHelmy Feb 12, 2023
25566af
test null exception
ZeinabAbdien00 Feb 12, 2023
147c329
null exception test
ZeinabAbdien00 Feb 12, 2023
65820d6
execute logic
ZeinabAbdien00 Feb 12, 2023
3cba05f
add isSuitableApartment function
AzizaHelmy Feb 12, 2023
24d5a8a
create FakeData which we would use in testing
ahmednasserzaza Feb 12, 2023
b4b88b5
rename Top10CitiesFruitsAndVegetablesLowestCostInteractor to GetTop10…
ahmednasserzaza Feb 12, 2023
e26e9e9
create test for GetTop10CitiesFruitsAndVegetablesLowestCostInteractor
ahmednasserzaza Feb 12, 2023
b83b97a
add test cases to isSuitableApartment function
AzizaHelmy Feb 12, 2023
38e089c
add the implementation to isSuitableApartment function
AzizaHelmy Feb 12, 2023
29a68cc
add getMonthlySalariesInAllCities function
AzizaHelmy Feb 12, 2023
4712876
edit interactor name
Feb 12, 2023
5a9aa9d
implement execute
mahmmedn19 Feb 12, 2023
edac348
rename lambda
Mohamedragabali Feb 12, 2023
3556127
edit two test cases name and fake data
Feb 12, 2023
78921f1
add test return null if no cities have internet price
mahmmedn19 Feb 12, 2023
3763b38
add 2 test cases for excludeNullFruitsAndVegetables
ahmednasserzaza Feb 12, 2023
4f371d8
add first test of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 10, 2023
8fa7a2f
add second test of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 10, 2023
ef872a1
add third test of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 10, 2023
6591eb9
add forth test of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 10, 2023
3d3f593
add implementation of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 10, 2023
cb0a065
delete GetCityHasCheapestInternetConnectionInteractorTest
M7mdSh3banX Feb 10, 2023
e5f8df8
add ThreeSpecificCountries enum class
M7mdSh3banX Feb 11, 2023
120c64d
add new object in FakeData
ahmednasserzaza Feb 12, 2023
5b5f953
add function excludeNullFruitsAndVegetables
ahmednasserzaza Feb 12, 2023
c449bbb
enhance all test cases of citiesInUSACanadaAndMexico function
M7mdSh3banX Feb 12, 2023
f39b085
edit test case name
Feb 12, 2023
9dc62d5
Merge branch 'develop' of https://github.com/AzizaHelmy/cost-of-livin…
M7mdSh3banX Feb 12, 2023
ffe26b8
Merge remote-tracking branch 'origin/feature/cheapest-meal' into feat…
M7mdSh3banX Feb 12, 2023
2cb312f
add test cases for excludeNullSalaries
ahmednasserzaza Feb 12, 2023
265e43a
add implementation for excludeNullSalaries
ahmednasserzaza Feb 12, 2023
97fe3bd
edit test case
Feb 12, 2023
1e668ba
add first test case for execute
ahmednasserzaza Feb 12, 2023
6cd1076
add implementation for first test case of execute
ahmednasserzaza Feb 12, 2023
8a64a9a
refactor fun execute and updated test
mahmmedn19 Feb 12, 2023
ca5b3f1
execute logic and legal data
ZeinabAbdien00 Feb 12, 2023
7c7e235
add class get-city-has-lowest-years-to-buy-apartment-interactor and t…
SaraSallah Feb 12, 2023
b1eb2a2
add fake data
SaraSallah Feb 12, 2023
d4ea7d0
Merge remote-tracking branch 'origin/feature/fastest-year-to-buy-apar…
SaraSallah Feb 12, 2023
06a6427
edit fake data and add 2 test cases to check null of salary and qulai…
SaraSallah Feb 12, 2023
f86340c
add implementation in fun exclude nullprice and low qualiy
Feb 12, 2023
5ab280b
edit fake data to suitable function that check nullability quality d…
SaraSallah Feb 12, 2023
10de75f
add testcases to isCityHasAverageMealPrice function
NargesNagy Feb 12, 2023
dbd5ae7
add implementaion to isCityHasAverageMealPrice function
NargesNagy Feb 12, 2023
884f254
add testcases to getAverageMealInCity function
NargesNagy Feb 12, 2023
9afed1c
add implementation to getAverageMealInCity function
NargesNagy Feb 12, 2023
9130f9d
add 3 test cases to check full time salary if equal positive , negati…
SaraSallah Feb 13, 2023
12f0478
add test case to check limit is negative for fun execute
SaraSallah Feb 13, 2023
f0e3d7d
add fun get number of years to buy apartment and add implementation i…
Feb 13, 2023
8e6ef4f
add 2 test cases for getAverageMealInAllCities function
M7mdSh3banX Feb 13, 2023
c9195a8
add implementation of getAverageMealInAllCities function
M7mdSh3banX Feb 13, 2023
d2dbabd
add test case to check full time Salary is negative or zero for fun g…
SaraSallah Feb 13, 2023
975464a
add implementation of function get number of years to buy apartment a…
Feb 13, 2023
37d428f
add implementation of excute function
NargesNagy Feb 13, 2023
353b15e
call execute function in main
M7mdSh3banX Feb 13, 2023
2a432f4
delete unused importing libraries
M7mdSh3banX Feb 13, 2023
86c4360
add throws exception of function get number of years to buy apartment
Feb 13, 2023
4466279
all test cases are and delete unused library
SaraSallah Feb 13, 2023
583a3bf
update comments in test class
NargesNagy Feb 13, 2023
52dc388
call function execute in main function
Feb 13, 2023
a5c6e22
add fake data class
Rehammashal7 Feb 13, 2023
54a2ddc
add test cases
Rehammashal7 Feb 13, 2023
fafc742
implementation the function
Rehammashal7 Feb 13, 2023
58dbc0a
add some objects to fake data
ahmednasserzaza Feb 13, 2023
cb906fd
enhance function execute and add some helper functions
ahmednasserzaza Feb 13, 2023
0361196
edit and add some test cases for helper functions
ahmednasserzaza Feb 13, 2023
ba582a3
add implementations for helper functions in GetTopCitiesFruitsAndVege…
ahmednasserzaza Feb 13, 2023
0db6eb2
add 2 test case for function execute in GetTopCitiesFruitsAndVegetabl…
ahmednasserzaza Feb 13, 2023
b13604a
add new object to fake data
ahmednasserzaza Feb 13, 2023
4e244dc
edit test case in excludeNullFruitAndVegetablePricesOrNullSalaries
ahmednasserzaza Feb 13, 2023
5e3df85
change test cases
Rehammashal7 Feb 13, 2023
ca1b87a
change the implementation of the function
Rehammashal7 Feb 13, 2023
264fb0b
add throw exception in execute function
Feb 13, 2023
25a3284
edit throw exception in execute function
Feb 13, 2023
a46b477
add test case for execute function
AzizaHelmy Feb 13, 2023
013a723
add implementation for execute function
AzizaHelmy Feb 13, 2023
92cb461
clean up exclude null function
AzizaHelmy Feb 13, 2023
0d298f3
clean up un needed function
AzizaHelmy Feb 13, 2023
560617a
handel fakeData to pass the tests and refactor the name of some tests
AzizaHelmy Feb 13, 2023
4b452ff
Merge pull request #3
AzizaHelmy Feb 13, 2023
8dbf4b2
Merge remote-tracking branch 'origin/feature/highest_rent' into develop
AzizaHelmy Feb 13, 2023
945bd27
handel fakeData to pass the tests of the highest rent feature
AzizaHelmy Feb 13, 2023
0cd8266
Merge remote-tracking branch 'origin/develop' into develop
AzizaHelmy Feb 13, 2023
1f5dfed
enhance and reformat the code
AzizaHelmy Feb 13, 2023
c98044e
Merge remote-tracking branch 'origin/feature/cheapest-banana' into de…
AzizaHelmy Feb 13, 2023
ed7f51b
handel the code to pass the test
AzizaHelmy Feb 13, 2023
9bc7ff1
Merge remote-tracking branch 'origin/feature/cheapest-fruit-and-veget…
AzizaHelmy Feb 13, 2023
f35d90c
handel fake data to pass the test
AzizaHelmy Feb 13, 2023
d214396
Merge remote-tracking branch 'origin/feature/cheapest-meal' into develop
AzizaHelmy Feb 13, 2023
854a774
clean up unnecessary class
AzizaHelmy Feb 13, 2023
bf50830
Merge remote-tracking branch 'origin/feature/corbonate-drink-high-tax…
AzizaHelmy Feb 13, 2023
6d3df07
Merge remote-tracking branch 'origin/feature/fastest-year-to-buy-apar…
AzizaHelmy Feb 13, 2023
eb189df
clean up the code
AzizaHelmy Feb 13, 2023
4126e4b
Merge remote-tracking branch 'origin/feature/get-salary-averages-for-…
AzizaHelmy Feb 13, 2023
7a79358
clean up the code to pass the tests
AzizaHelmy Feb 13, 2023
65cdda5
handel fake data class
AzizaHelmy Feb 13, 2023
a63693f
Merge remote-tracking branch 'origin/feature/top-five-names-city-clot…
AzizaHelmy Feb 13, 2023
0d7b81d
clean up the code
AzizaHelmy Feb 13, 2023
86c104a
handel code to pass the test
AzizaHelmy Feb 13, 2023
8093e1e
updated fun execute and updated test
mahmmedn19 Feb 13, 2023
d33efe3
update JDK version
M7mdSh3banX Feb 13, 2023
706b90f
Merge remote-tracking branch 'origin/develop' into develop
M7mdSh3banX Feb 13, 2023
95c52a5
add enums package
M7mdSh3banX Feb 13, 2023
fd2e53e
update citiesInUSACanadaAndMexico function name
M7mdSh3banX Feb 13, 2023
42e8b76
add new tests
M7mdSh3banX Feb 14, 2023
18731fe
add exception if the list is empty
M7mdSh3banX Feb 14, 2023
5e54841
enhance filter of execute function
M7mdSh3banX Feb 14, 2023
09feecf
add FakeDataTwo Class
M7mdSh3banX Feb 14, 2023
b93a0ec
add test case for execute function
M7mdSh3banX Feb 14, 2023
e24c325
Merge branch 'develop' of https://github.com/AzizaHelmy/cost-of-livin…
mahmmedn19 Feb 14, 2023
ec79081
clean up unnecessary comments
ahmednasserzaza Feb 14, 2023
5a98cc9
add explanations for every test case
ahmednasserzaza Feb 14, 2023
c4819bd
change the args of function
Rehammashal7 Feb 14, 2023
10e1f56
change test cases
Rehammashal7 Feb 14, 2023
eb93472
implementation of the function
Rehammashal7 Feb 14, 2023
92e1d13
Merge branch 'develop' of https://github.com/AzizaHelmy/cost-of-livin…
mahmmedn19 Feb 14, 2023
42ba582
change index
Rehammashal7 Feb 14, 2023
040dec4
Merge remote-tracking branch 'origin/develop' into develop
Rehammashal7 Feb 14, 2023
75c4fac
clean up all the code and add the entry points in the Main
AzizaHelmy Feb 14, 2023
378f5cb
use data source in class GetTopTenCountryEnforceHighTaxesOnCarbonated…
Feb 14, 2023
83a3c7f
Merge remote-tracking branch 'origin/develop' into develop
Feb 14, 2023
8ee5026
update function in Main.kt
Feb 14, 2023
890f189
move createCity to FakeData
Feb 14, 2023
ba82ed5
edit test cases name and refactor class GetSalaryAverageForCitiesInCo…
Feb 16, 2023
d976944
delete fake data
Feb 16, 2023
c43abf4
delete enum class ThreeSpecificCountries from the package
M7mdSh3banX Feb 17, 2023
10496dc
enhance class name and fix some issues
M7mdSh3banX Feb 17, 2023
519fa84
update class name in all usages
M7mdSh3banX Feb 17, 2023
4f4ba85
update class file name
M7mdSh3banX Feb 17, 2023
39eec37
update test class file name
M7mdSh3banX Feb 17, 2023
647bb02
add fake data
Rehammashal7 Feb 17, 2023
eab0c8a
rename FakeDataTwo
ahmednasserzaza Feb 17, 2023
01e7e79
create MockCityEntity for testing
ahmednasserzaza Feb 17, 2023
b96a7e0
add createMockCity function overloaded in MockCityEntity
ahmednasserzaza Feb 17, 2023
c3e1388
change parameter type in GetCheapestBananaCitiesNamesInteractor
ahmednasserzaza Feb 17, 2023
2ebe203
edit parameter in object getCheapestBananaCitiesNames
ahmednasserzaza Feb 17, 2023
f6a4cf8
Merge remote-tracking branch 'origin/develop' into fix/average-meal-r…
M7mdSh3banX Feb 17, 2023
a14dd34
edit the class GetTop5CitiesNameHasSuitableClothesPricesInteractor
Mohamedragabali Feb 17, 2023
d16d19b
add asSequence to improve performance
ZeinabAbdien00 Feb 17, 2023
88e2537
delete the additional class and data class
Mohamedragabali Feb 17, 2023
53d9a0b
edit test cases in GetCheapestBananaCitiesNamesInteractorTest
ahmednasserzaza Feb 17, 2023
6cc7ae7
use mock in class test
Feb 17, 2023
3abc7a0
rename test class GetTop5CitiesNameHasSuitableClothesPricesInteractor…
Mohamedragabali Feb 17, 2023
8298ef3
add distinct operator at function execute on GetCheapestBananaCitiesN…
ahmednasserzaza Feb 17, 2023
f8faa78
enhance performance of the GetCityHasAverageMealPricesInteractor
M7mdSh3banX Feb 17, 2023
5f5cdd2
edit first test case
Mohamedragabali Feb 17, 2023
8d4467c
edit name mock data
Feb 17, 2023
ef7a69a
edit to best performance
Feb 17, 2023
bebc81d
update moke data
SaraSallah Feb 17, 2023
91018de
edit name variable has the result of excute fun
Mohamedragabali Feb 17, 2023
a0b5b7e
edit to best performance
Feb 17, 2023
84f43e7
add all test cases with edits
Mohamedragabali Feb 17, 2023
83ab3bd
update all test cases using mock
M7mdSh3banX Feb 17, 2023
ca3aa33
edit code in main for getTop5NamesCitiesHasClothesFamousBrandsWithSui…
Mohamedragabali Feb 17, 2023
2d5f718
clean up unnecessary imports in GetCheapestBananaCitiesNamesInteracto…
ahmednasserzaza Feb 17, 2023
e908e34
add getAverageMealInCity in its model
M7mdSh3banX Feb 17, 2023
17d052e
delete getAverageMealInCity tests
M7mdSh3banX Feb 17, 2023
2f452fb
enhance the code and use scope function
AzizaHelmy Feb 17, 2023
25334b0
use mock library in testing
AzizaHelmy Feb 17, 2023
86a6263
update test cases in GetTopCitiesFruitsAndVegetablesLowestCostInterac…
ahmednasserzaza Feb 18, 2023
1d57394
create class SearchCheapestCarInCountryInteractor
Feb 18, 2023
bbbe9ff
add function in MockCityEntity.kt and
Feb 18, 2023
a0959a7
update regions in MockCityEntity
ahmednasserzaza Feb 18, 2023
c9ee855
add six test cases in SearchCheapestCarInCountryInteractorTest
Feb 18, 2023
22f89af
write all functions in SearchCheapestCarInCountryInteractor
Feb 18, 2023
47c4d4c
enhance execute function
AzizaHelmy Feb 18, 2023
ce395b2
fix the issue of the test method to pass
AzizaHelmy Feb 18, 2023
1bed4f1
add fun getAverageFruitAndVegetablesPrices in FruitAndVegetablesPrices
ahmednasserzaza Feb 18, 2023
6329980
Merge remote-tracking branch 'origin/fix/cheapest-banana-not-include-…
AzizaHelmy Feb 18, 2023
b30d1bb
add fun getAverageClothesPrices in ClothesPrices
ahmednasserzaza Feb 18, 2023
480b0ec
resolve conflicts
AzizaHelmy Feb 18, 2023
6a24b8e
Merge remote-tracking branch 'origin/fix-update-get-salary-average' i…
AzizaHelmy Feb 18, 2023
9e7cb5b
add two functions in MealsPrices model
ahmednasserzaza Feb 18, 2023
d72095f
update implementation of class Get_City_Has_Lowest_Years_To_Buy_Apart…
SaraSallah Feb 18, 2023
f07303f
fix issues in test cases of class Get_City_Has_Lowest_Years_To_Buy_Ap…
SaraSallah Feb 18, 2023
da779fe
add function getSumOfFoodPricesByEveryItemQuantity in FoodPrices model
ahmednasserzaza Feb 18, 2023
d194042
add some improvements in SearchCheapestCarInCountryInteractor
Feb 18, 2023
06c0faa
edit test cases in SearchCheapestCarInCountryInteractorTest
Feb 18, 2023
4bd3b2e
remove number ten from class name
ZeinabAbdien00 Feb 18, 2023
3b562db
correct class name in main
ZeinabAbdien00 Feb 18, 2023
82cc644
reset parameters of problem 9 function
ZeinabAbdien00 Feb 18, 2023
679289a
convert fake data to mockk data
ZeinabAbdien00 Feb 18, 2023
f3e872f
test return data when passed nuu parameter
ZeinabAbdien00 Feb 18, 2023
503057e
test return null data if data quality is low
ZeinabAbdien00 Feb 18, 2023
7cd56df
update two functions to GetCityHasCheapestInternetConnectionInteracto…
ahmednasserzaza Feb 18, 2023
8aa97d8
pass limit parameter to execute function in getCityHasCheapestInterne…
ahmednasserzaza Feb 18, 2023
cada79e
Merge remote-tracking branch 'origin/fix/edit-test-class-get-top-city…
AzizaHelmy Feb 18, 2023
39e1710
Merge remote-tracking branch 'origin/fix/some-models-not-exclude-aver…
AzizaHelmy Feb 18, 2023
e99e69e
Merge remote-tracking branch 'origin/fix/average-meal-result' into de…
AzizaHelmy Feb 18, 2023
faf8746
resolve conflicts
AzizaHelmy Feb 18, 2023
0e5e644
make averageMonthlyNetSalary nullable in first function
ahmednasserzaza Feb 18, 2023
9fe55b6
update test cases in GetCityHasCheapestInternetConnectionInteractorTe…
ahmednasserzaza Feb 18, 2023
cec765c
fix execute function distinct and Descending sort
ZeinabAbdien00 Feb 18, 2023
205a8f3
Merge remote-tracking branch 'origin/fix/test-cases-not-enough-in-che…
AzizaHelmy Feb 18, 2023
bcae442
Merge remote-tracking branch 'origin/fix/city-has-lowest-years-update…
AzizaHelmy Feb 18, 2023
72f87cc
use scope function
AzizaHelmy Feb 18, 2023
c1dae39
edit test cases in SearchCheapestCarInCountryInteractorTest
Feb 18, 2023
0e5eddb
Merge remote-tracking branch 'origin/fix/carbonate-high-tax-issue' in…
AzizaHelmy Feb 18, 2023
9a5dbd8
edit function execute in SearchCheapestCarInCountryInteractor
Feb 18, 2023
e9069ef
Merge remote-tracking branch 'origin/develop' into develop
AzizaHelmy Feb 18, 2023
4b85d86
use function getAverageFruitAndVegetablesPrices exists in model
ahmednasserzaza Feb 18, 2023
a4f8da6
update test cases in GetTopCitiesFruitsAndVegetablesLowestCostInterac…
ahmednasserzaza Feb 18, 2023
8916ea0
Merge remote-tracking branch 'origin/fix/use-functions-in-models' int…
AzizaHelmy Feb 18, 2023
1cb007c
edit function GetSalaryAverageForCitiesInCountryInteractor
Feb 18, 2023
ab31b7a
edit function GetSalaryAverageForCitiesInCountryInteractor
Feb 18, 2023
3242620
Merge remote-tracking branch 'origin/develop' into develop
Feb 18, 2023
1fa94e4
enhance the code
AzizaHelmy Feb 18, 2023
56a50c9
Merge remote-tracking branch 'origin/develop' into develop
AzizaHelmy Feb 18, 2023
7d9e656
enhance code
Feb 18, 2023
e9430bc
Merge remote-tracking branch 'origin/develop' into develop
Feb 18, 2023
e90f233
rename the name of test function
AzizaHelmy Feb 18, 2023
f94b41c
Merge remote-tracking branch 'origin/develop' into develop
AzizaHelmy Feb 18, 2023
d164217
clean up the code
AzizaHelmy Feb 18, 2023
81b4e90
update the names of some test cases to make them more descriptive, an…
mahmmedn19 Feb 18, 2023
3d1bb35
update test cases in GetCityHasLowestYearsToBuyApartmentInteractorTest
ahmednasserzaza Feb 18, 2023
5670b1f
Merge remote-tracking branch 'origin/develop' into develop
ahmednasserzaza Feb 18, 2023
e19fb1d
edit name fun in test cases
Mohamedragabali Feb 18, 2023
6dac040
edit fun to scope in GetTopCitiesNameHasSuitableClothesPricesInteractor
Mohamedragabali Feb 18, 2023
56670ec
Merge remote-tracking branch 'origin/develop' into develop
Mohamedragabali Feb 18, 2023
b25bf88
update test cases in GetCityHasCheapestInternetConnectionInteractorTest
ahmednasserzaza Feb 18, 2023
5c95596
Merge remote-tracking branch 'origin/develop' into develop
ahmednasserzaza Feb 18, 2023
7926710
update test cases in GetTopCitiesNameHasSuitableClothesPricesInteract…
ahmednasserzaza Feb 18, 2023
223ce04
add function to MockCityEntity class
NargesNagy Feb 18, 2023
890f2d7
add test cases for execludeNullSalaryAndQualityDataAndOtherBaicPrices…
NargesNagy Feb 18, 2023
fe73274
add implemintation for execludeNullSalaryAndQualityDataAndOtherBaicPr…
NargesNagy Feb 18, 2023
632c522
add test cases for execute function
NargesNagy Feb 18, 2023
127f1fd
Revert "add test cases for execute function"
NargesNagy Feb 18, 2023
00566ef
add implementation for execute function
NargesNagy Feb 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ build/
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/.misc.xml
.idea/.gradle.xml

.idea/libraries/
*.iws
*.iml
Expand Down
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ repositories {

dependencies {
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
//testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
testImplementation("io.mockk:mockk:1.10.6")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
}

tasks.test {
Expand Down
8 changes: 8 additions & 0 deletions resources/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Created by Aziza Helmy on ${DATE}.
*/
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
80 changes: 73 additions & 7 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,88 @@
import dataSource.CsvDataSource
import dataSource.utils.CsvParser
import enums.TheTypeOfApartments
import interactor.*
import interactor.CostOfLivingDataSource
import interactor.GetCityHasCheapestInternetConnectionInteractor
import interactor.GetHighestSalaryAverageCititesNamesInteractor
import interactor.GetCityHasLowestYearsToBuyApartmentInteractor
import interactor.GetCityHasAverageMealPricesInteractor
import interactor.GetSalaryAverageForCitiesInCountryInteractor

fun main() {
val csvParser = CsvParser()
val dataSource: CostOfLivingDataSource = CsvDataSource(csvParser)


// region HighestSalaryAverageCities
val getHighestSalaryAverageCities = GetHighestSalaryAverageCititesNamesInteractor(dataSource)
println(getHighestSalaryAverageCities.execute(limit = 10))
println(getHighestSalaryAverageCities.execute(limit = 5))
printSeparationLine()

//endregion
//region 1-CityHasCheapestInternetConnection
val getCityHasCheapestInternetConnectionInteractor = GetCityHasCheapestInternetConnectionInteractor(dataSource)
println(getCityHasCheapestInternetConnectionInteractor.execute())

println(getCityHasCheapestInternetConnectionInteractor.execute(100))
printSeparationLine()
//endregion
//region 2-TopCitiesFruitsAndVegetablesLowestCost
val getTopCitiesFruitsAndVegetablesLowestCost = GetTopCitiesFruitsAndVegetablesLowestCostInteractor(dataSource)
println(getTopCitiesFruitsAndVegetablesLowestCost.execute(10))
printSeparationLine()
//endregion
//region 3-SalaryAverageForCitiesInCountry
val getSalaryAverageForCitiesInCountry = GetSalaryAverageForCitiesInCountryInteractor(dataSource)
println(getSalaryAverageForCitiesInCountry.execute("Egypt"))
println(getSalaryAverageForCitiesInCountry.execute("Turkey"))
println(getSalaryAverageForCitiesInCountry.execute("syria"))
printSeparationLine()
//endregion
//region 4-CityHasHighestDifferentRentBetweenCityCenterAndOutside
val getCityHasHighestDifferentRentBetweenCityCenterAndOutside =
GetCityHasHighestDifferentRentBetweenCityCenterAndOutsideInteractor(dataSource)
println(getCityHasHighestDifferentRentBetweenCityCenterAndOutside.execute(TheTypeOfApartments.ONE_BED_ROOM))
printSeparationLine()
//endregion
//region 5-Top5CitiesNameHasSuitableClothesPrices
val numberOfCityShouldReturn = 5
val getTop5NamesCitiesHasClothesFamousBrandsWithSuitablePricesInteractor =
GetTopCitiesNameHasSuitableClothesPricesInteractor(dataSource)
println(getTop5NamesCitiesHasClothesFamousBrandsWithSuitablePricesInteractor.execute(numberOfCityShouldReturn))
printSeparationLine()
//endregion
// region 6-CityHasLowestYearsToBuyApartment
val getCityHasLowestYearsToBuyApartment = GetCityHasLowestYearsToBuyApartmentInteractor(dataSource)
println(getCityHasLowestYearsToBuyApartment.execute(10))
println(getCityHasLowestYearsToBuyApartment.execute(7))
println(getCityHasLowestYearsToBuyApartment.execute(0))
printSeparationLine()
//endregion
//region 7-CheapestBananaCitiesNames
val getCheapestBananaCitiesNames = GetCheapestBananaCitiesNamesInteractor(dataSource)
println(getCheapestBananaCitiesNames.execute(dataSource.getAllCitiesData()[0]))
printSeparationLine()
//endregion
//region 8-CityHasCheapestMealPrices
val getCityHasCheapestMealPrices = GetCityHasAverageMealPricesInteractor(dataSource)
println(getCityHasCheapestMealPrices.execute())
printSeparationLine()
//endregion
//region 9-TopTenCountryEnforceHighTaxesOnCarbonatedDrinks
val getTopTenCountryEnforceHighTaxesOnCarbonatedDrinks =
GetTopCountryEnforceHighTaxesOnCarbonatedDrinksInteractor(dataSource)
println(getTopTenCountryEnforceHighTaxesOnCarbonatedDrinks.execute(10))
printSeparationLine()
//endregion
//region 10-SuitableCityMoreSavingPerMonth
val getSuitableCityMoreSavingPerMonth = GetSuitableCityMoreSavingPerMonthInteractor(dataSource)
println(getSuitableCityMoreSavingPerMonth.execute())
printSeparationLine()
//endregion
//region 11-SearchCheapestCarInCountryInteractor
val searchCheapestCarInCountryInteractor = SearchCheapestCarInCountryInteractor(dataSource)
println(searchCheapestCarInCountryInteractor.execute("Egypt",3))
printSeparationLine()
//endregion
}
private fun printSeparationLine(){

private fun printSeparationLine() {
print("\n_______________________________\n")
}

7 changes: 7 additions & 0 deletions src/main/kotlin/enums/TheTypeOfApartments.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package enums


enum class TheTypeOfApartments {
ONE_BED_ROOM,
THREE_BED_ROOMS
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package interactor

import model.CityEntity

class GetCheapestBananaCitiesNamesInteractor(private val dataSource: CostOfLivingDataSource) {

fun execute(vararg cities: CityEntity): List<String> {
return dataSource
.getAllCitiesData()
.filter { it.fruitAndVegetablesPrices.banana1kg != null && it in cities }
.sortedBy { it.fruitAndVegetablesPrices.banana1kg }
.distinct()
.map { it.cityName }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package interactor

import model.CityEntity

class GetCheapestBasicPricesInAllCitiesComparingToAverageSalariesInteractor (
private val dataSource: CostOfLivingDataSource
) {

fun execute(): CityEntity? {
return dataSource
.getAllCitiesData()
.filter { execludeNullSalaryAndQualityDataAndOtherBaicPrices(it) != null }
.maxByOrNull {
(it.averageMonthlyNetSalaryAfterTax)!! -
(it.transportationsPrices.monthlyPassRegularPrice
!! + it.servicesPrices.basicElectricityHeatingCoolingWaterGarbageFor85m2Apartment!!
+ it.realEstatesPrices.apartmentOneBedroomInCityCentre!!)
}
}

fun execludeNullSalaryAndQualityDataAndOtherBaicPrices(cityEntity: CityEntity): Boolean? {
return cityEntity.run {
dataQuality
&& averageMonthlyNetSalaryAfterTax != null
&& realEstatesPrices.apartmentOneBedroomInCityCentre != null
&& servicesPrices.basicElectricityHeatingCoolingWaterGarbageFor85m2Apartment != null
&& transportationsPrices.monthlyPassRegularPrice != null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package interactor

import model.CityEntity
import kotlin.math.ceil
import kotlin.math.floor

class GetCityHasAverageMealPricesInteractor(
private val dataSource: CostOfLivingDataSource
) {

fun execute(): CityEntity? {

val listOfCitiesEntity = dataSource.getAllCitiesData()
.filter { isCitiesInUSACanadaAndMexico(it) && excludeNullMealPrices(it) }
.sortedByDescending { it.mealsPrices.getAverageMealInCity(it) }

return if (listOfCitiesEntity.isNotEmpty()) getAverageMealInAllCities(listOfCitiesEntity)
else throw Throwable("List of cities is empty")
}

fun isCitiesInUSACanadaAndMexico(city: CityEntity): Boolean {
return city.country == ThreeSpecificCountries.USA.nameOFCountry
|| city.country == ThreeSpecificCountries.CANADA.nameOFCountry
|| city.country == ThreeSpecificCountries.MEXICO.nameOFCountry
}

fun excludeNullMealPrices(city: CityEntity): Boolean {
return (city.mealsPrices.mealFor2PeopleMidRangeRestaurant != null)
|| ((city.mealsPrices.mealInexpensiveRestaurant != null)
&& (city.mealsPrices.mealAtMcDonaldSOrEquivalent != null))
}

fun getAverageMealInAllCities(cityEntityList: List<CityEntity>): CityEntity? {
if (cityEntityList.isEmpty()) return null
val averageMealPricesInAllCities =
(cityEntityList.first().mealsPrices.getAverageMealInCity(cityEntityList.first())!! +
cityEntityList.last().mealsPrices.getAverageMealInCity(cityEntityList.last())!!).div(2)

return cityEntityList.first {
(it.mealsPrices.getAverageMealInCity(it) == averageMealPricesInAllCities)
|| (it.mealsPrices.getAverageMealInCity(it) == floor(averageMealPricesInAllCities))
|| (it.mealsPrices.getAverageMealInCity(it) == ceil(averageMealPricesInAllCities))
}
}
}

enum class ThreeSpecificCountries(val nameOFCountry: String) {
USA("United States"),
CANADA("Canada"),
MEXICO("Mexico"),
EGYPT("Egypt")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@ package interactor
import model.CityEntity

class GetCityHasCheapestInternetConnectionInteractor(
private val dataSource: CostOfLivingDataSource,
private val dataSource: CostOfLivingDataSource
) {

fun execute(): CityEntity{
throw Throwable("Not Implemented yet")
fun execute(limit: Int): CityEntity? {
return dataSource
.getAllCitiesData()
.filter(::excludeNullInternetOrNullSalaries)
.take(limit)
.minByOrNull(::compareInternetCostToSalary)
}

private fun excludeNullInternetOrNullSalaries(city: CityEntity): Boolean {
return city.run {
servicesPrices.internet60MbpsOrMoreUnlimitedDataCableAdsl != null && averageMonthlyNetSalaryAfterTax != null
}
}

private fun compareInternetCostToSalary(city: CityEntity): Float {
return city.run {
(servicesPrices.internet60MbpsOrMoreUnlimitedDataCableAdsl!! / averageMonthlyNetSalaryAfterTax!!) * 100
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package interactor

import enums.TheTypeOfApartments
import model.CityEntity
import kotlin.math.abs

class GetCityHasHighestDifferentRentBetweenCityCenterAndOutsideInteractor(
private val dataSource: CostOfLivingDataSource
) {

fun execute(type: TheTypeOfApartments): CityEntity {
if (type == TheTypeOfApartments.ONE_BED_ROOM) {
return dataSource.getAllCitiesData()
.filter(::excludeNullRentOneTypeOneAndLowQualityData)
.maxByOrNull {
abs(
it.realEstatesPrices.apartmentOneBedroomInCityCentre!!
- it.realEstatesPrices.apartmentOneBedroomOutsideOfCentre!!
)
}!!

} else {
return dataSource.getAllCitiesData()
.filter(::excludeNullRentOneTypeTwoAndLowQualityData)
.maxByOrNull {
abs(
it.realEstatesPrices.apartment3BedroomsInCityCentre!! -
it.realEstatesPrices.apartment3BedroomsOutsideOfCentre!!
)
}!!

}
}

private fun excludeNullRentOneTypeOneAndLowQualityData(city: CityEntity): Boolean {
return city.dataQuality
&& city.realEstatesPrices.apartmentOneBedroomInCityCentre != null
&& city.realEstatesPrices.apartmentOneBedroomOutsideOfCentre != null
}


private fun excludeNullRentOneTypeTwoAndLowQualityData(city: CityEntity): Boolean {

return city.dataQuality
&& city.realEstatesPrices.apartment3BedroomsInCityCentre != null
&& city.realEstatesPrices.apartment3BedroomsOutsideOfCentre != null


}
}




Loading