我要去采访他们给了我以下项目你能不能给我一个 [英] am going to interviews they gave me the following project can you please give me a

查看:75
本文介绍了我要去采访他们给了我以下项目你能不能给我一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您需要设计和编写一个C#控制台应用程序(任何其他应用程序是自动失败!!),它将分析输入文件(InputFile.txt);该文件包含每行的日期。您的算法应输出所有丢失的日期,不包括星期六和星期日。你不应该迎合公众假期。另请注意:每个闰年(每4年)包含2月29日的额外日期。闰年:2000年,2004年,2008年,...



您的结果还应输出日期范围而不是每个日期;如果缺少多个并发日期。例如:如果您缺少2008/02 / 03,2008 / 02/04和2008/02/05,则应输出2008/02/03 - 2008/02/05。



您的输出应写入文件(OutputFile.txt)。将使用您的名称在本地驱动器上创建一个文件夹,该文件夹应包含您的所有解决方案和源文件,以及您的输出文件。

You are required to design and write a C# console application (Any other application is an automatic fail!!) that will analyze an input file (InputFile.txt); the file contains a date on each line. Your algorithm should output all the missing dates, excluding Saturdays and Sundays. You should not cater for public holidays. Also keep in mind: each leap year (every 4 years) contains an extra date for February 29th. Leap years: 2000, 2004, 2008, …

Your results should also output a date range instead of each individual date; if there is more than one concurrent date missing. For example: if you are missing 2008/02/03, 2008/02/04 and 2008/02/05 you should output 2008/02/03 – 2008/02/05.

Your output should be written to a file (OutputFile.txt). A folder will be created on the Local Drive with your Name, this folder should contain all your solution and source files, as well as your output file.

推荐答案

好吧,如果我们给你解决方案,你得到了工作,你会把工资交给我们吗?不,当然不是,所以你需要做必要的工作,向面试官证明你有能力完成这项工作。
Well if we give you the solution and you get the job, will you hand over your salary to us? No, of course not, so you need to do the work necessary to demonstrate to the interviewer that you have the skills to do the job.


同意理查德。



但是只是为了鼓励OP:

将整个问题分解为以下简单步骤:



1.如何打开txt文件进行解析

2.如何逐行阅读

3.如何将字符串日期转换为实际日期格式

4.然后如何设置逻辑来识别缺失的日期

5.如何按照要求的格式排列输出

6。如何将这个写入txt文件到特定的文件夹



如果你得到所有这些,那你的问题就解决了 - 而且你的工作就是你的。



希望这很有用
Agree with Richard.

But just to encourage the OP:
Break down this whole problem into simple steps like:

1. How to open a txt file for parsing
2. How to read line by line
3. How to convert the date which is as string into actual date format
4. Then how to put the logic to identify missing dates
5. How to arrange the output as per the required format
6. How to write this to a txt file into a specific folder

If you get all these pieces, then your problem solved - and the job is yours.

Hope this is useful


给我一些示例输入,即该文件的结构是什么
Give me some sample inputs ie what will be the structure of that file


这篇关于我要去采访他们给了我以下项目你能不能给我一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆