mhannsari
BAN USER
- 0of 0 votes
AnswersQuestion 2: Write code for the following: given a text file containing this information (Date the customer logged-in, Tab, Customer ID) Example: 04/11/2017 \t 0003 04/12/2017 \t 0003 04/13/2017 \t 0004 04/13/2017 \t 0003 04/13/2017 \t 0003 04/15/2017 \t 0004
- mhannsari in United States
How to get the list of those customers that log in on four consecutive days?
Please give good solution| Report Duplicate | Flag | PURGE
Amazon Java Developer - 0of 0 votes
AnswersQuestion 1: Given input file with the following set of strings, Download input file: https://www.google.com/basepages/producttype/taxonomy.en-US.txt
- mhannsari in United States
Example: Electronics Electronics > Arcade Equipment Electronics > Arcade Equipment > Basketball Arcade Games Electronics > Arcade Equipment > Pinball Machine Accessories Electronics > Arcade Equipment > Pinball Machines Electronics > Arcade Equipment > Skee-Ball Machines Electronics > Arcade Equipment > Video Game Arcade Cabinet Accessories Electronics > Arcade Equipment > Video Game Arcade Cabinets Electronics > Audio Electronics > Audio > Audio Accessories Electronics > Audio > Audio Accessories > Audio & Video Receiver Accessories Electronics > Audio > Audio Accessories > Headphone & Headset Accessories Electronics > Audio > Audio Accessories > Headphone & Headset Accessories > Headphone Cushions & Tips Electronics > Audio > Audio Accessories > Karaoke System Accessories
write a function that stores this information. Your data structure should be able to provide information as Electronics = 14 Electronics > Arcade Equipment = 7 Electronics > Arcade Equipment > Video Game Arcade Cabinets = 1 Electronics > Arcade Equipment > Skee-Ball Machines = 1| Report Duplicate | Flag | PURGE
Amazon Java Developer
Public static List<int> GetConsecutiveCustomer(string filepath)
{
var customeDateMap = new Dictionary<int,List<Date>>();
var streamReader = new StreamReader(new FileStream(filepath, FileMode.Open, FileAccess.Read), Encoding.UTF8);
var consecutiveCustomers = new HashSet<int>();
while((var line = streamReader.ReadLine()) != null)
{
var customerId = Int32.Parse(line.Split('\t')[1]);
var date = Date.Parse(line.Split('\t')[0]);
if(customeDateMap.ContainsKey(customerId)
{
if(customeDateMap[customerId].Length == 3)
{
customeDateMap[customerId].RemoveAt(2);
}
customeDateMap[customerId].Add(date);
if(!consecutiveCustomers.Contains(customerId))
{
if(customeDateMap[customerId].Length == 3
&& customeDateMap[customerId][0] == customeDateMap[customerId][1].AddDays(1)
&& customeDateMap[customerId][0] == customeDateMap[customerId][2].AddDays(2))
{
consecutiveCustomers.Add(customerId);
}
}
}
else
{
customeDateMap.Add(customerId, new List<date>(){date});
}
}
return consecutiveCustomers.ToList<int>();
}
how to run it from main method
Replisanielson212, Associate at ASAPInfosystemsPvtLtd
Now I work in freelancing in Search Engine optimization. I like reading nobbles, old stories, love stories. I am happy ...
RepAugment is a mobile app that lets you and your customers visualize your 3D models in Augmented Reality. If you ...
Repangeljperez232, Animator at ADP
Hello,I am a Marketing Manager. And I have 2+ experience in Marketing Manager.I like to read about vashikaran ...
Repstellaaluya212, Consultant at Student
Hi Everyone, My name is Stella Aluya From FL,Florida, piano and voice educator, has been educating since 2007. What ...
RepI am Jenae Wilder and I work as a content writer, A writer at day, and a reader at night ...
RepDo you Need Voodoo Spell For love, revenge or voodoo spells for cheaters? Consult Free right away to get custom ...
RepStevenMarkow19, Graphics Programmer at xyz
Hello Everyone,I am Steven Markow and right now going to my 2nd semester with the International Education program. With ...
RepElenaKudaeva455, Music Piano Store at xyz
Hello Everyone,My name is Elena Kudaeva From NV,Nevada,USA.I am 16 years of age and I have ...
Repstanjachrissi, Integration Software Engineer at xyz
Hi,my name is Stanja Chrissi. I was conceived and FL. I moved on from CA and went ahead to ...
RepEmilyWeigel45, Music Store at xyz
Hello Everyone,My name is Emily Weigel and I have been showing piano and voice for as long as 15 ...
Repobireemma212, teaching piano at xyz
Hello Everyone,Obire Emma has been showing piano and violin for over 21 years. She holds a Bachelor's degree ...
RepAmber Van is registered and fully insured cheap removal company in Bristol.Our featured services includes domestic moves,commercial moves ...
Repadorasherlyn253, SEO
I am a professor, I have 5 years of experience. I have seen a lot of cases in my life ...
RepHire high professional child development center in Charlotte. Pal-A-Roo’s Child Development Center is a family-owned child care facility offering ...
RepShakirajensen45, Program Manager at Service Now
Shakira Jensen piano at Meridian Music from 2004-2010, and it is a benefit to welcome him back. He has numerous ...
RepPrestige Luxury Rentals, Tech Lead at Prestige Luxury Rentals
Prestige Luxury Rentals is highly recommended company for exotic car rental Miami. With our top brand vehicles like; exotic, luxury ...
Repsohaperez1, abc at Not disclosed
I am working as an entertainment Journalist, I love to travel as well as love to explore new things and ...
Repsunstaley212, Graphics Programmer at Service Now
Hello Everyone, My name is sun staley and I am from new zealand. I might want to attempt this experience ...
RepOur mission is to provide informative and Self Improvement advice to help people live their lives better set definite goals ...
RepMosesanaughe212, Web Developer at Service Now
Hello there everyone,I'm Moses anaughe from Texas , United States. I finished my undergrad contemplates in science and am ...
RepJonathan Galgano, Data Engineer at Blue Jeans
Drive with the most affordable Exotic Car Rental South Beach. Prestige luxury Rentals is offering you with the finest car ...
RepNutsaAvaliani47, Student at Service Now
Hello Everyone,I am Nutsa Avaliani and I have been educating for more than 27 years and totally love it ...
RepDeveloped several new methods for licensing g.i. joes in Los Angeles, CA. Spent high school summers creating marketing channels ...
RepRocioNavarro189, None at Student
Hello Everyone,My name is Rocio Navarro Form Auckland,NZ,and 31 years old.I am searching for a servant ...
RepNisha Bhatt, Software Development Manager at Student
Hey Everyone, My name is Nisha Bhatt from Bangalore, (INDIA). I am an Android designer working in this industry for ...
RepSalliePanty19, my bookshop online at xyz
Hello everyone,My name is Sallie undies, I am initially from the wonderful province of Delaware. I got my four ...
RepSCREENish employee time tracking software can be used as desktop or mobile app. Once the employee has tracked his working ...
RepAre you looking for a simple remedy mantra or solution to seduce your husband? Is your husband not caring about ...
Reppamelacochran447, Intern at design
I am Pamela Cochran, and I am working as a Manager in Compact Disc Center. Last Month, I searched for ...
RepNY Vape Shop is the most popular Vaporizer Store for new trend vaporizer pen and all related accessories. We are ...
Repsaldanaholly212, Program Manager at Service Now
My name is Saldana Holly from Florida, USA.I originate from a family of 6 youngsters, 3 sisters and 1 ...
RepIf you want to attract someone then astrologer kumar can help you. Astrologer kumar is specialized in offering kamdev vashikaran ...
Replisaanderson1233, None at Student
Hello Everyone, My name is Lisa Anderson and I am an expert essayist, columnist, blogger and proofreader presently living in ...
RepRilesutton17, Music Studio at xyz
Hi Everyone,My Name is Riley Sutton From AL,Alabama state. i am a 24 year old.I am proficient ...
Repjomajogya, Applications Developer at Autonomy Zantaz
I’m a teacher assistant who supports the teacher in planning and presenting lessons, and helps students learn . I specialize ...
RepHave a strong interest in donating yogurt for the underprivileged. Spent several years building cabbage in Miami, FL. Spent several ...
Reploveastrologyspecialist7, Program Manager at Service Now
Hello Everyone,My name is Asena Kaya from Texas,United States. I am 25 years old.i am in the ...
RepRuizLeslie, Management accountant at Omni Superstore
Ruiz , a Management accountant with 4 years in the field of administrative functions, managing the office of the Leadership team ...
Repmillerrock3486, HTML Freshers at Aspire Systems
I am Web Designers create and build websites and web pages by combining any number of visual design elements including ...
Repbedinisha374, Project Leader at design
Juliana Christ, as I am a Project Manager at Morissette-Hegman, having experience of 6 years, currently dealing with brampton heating ...
RepJerryesumrall777, Consultant at None
Hello Everyone, My name is Jerrye Sumrall and I am 34 years of age and I originate from Ocean city ...
RepLynnebailey3333, Systems Design Engineer at None
Hello Everyone, My name is Lynne Bailey from Phoenix, AZ I am an expert visual originator. I am working this ...
very hard but you are just amazing.
- mhannsari May 15, 2017i am not able to eliminate the error, as you use 'using', 'StreamReader', etc.
i am using java 7, still difficult to understand your code.