首页 新闻 聚焦 科技 财经 创业 综合 图片 视频

IT界

旗下栏目: 行业 生态 IT界 创新

COMP2221编程代写、java程序调试

来源:互联网 发布时间:2021-02-19
COMP2221编程代写、java程序调试
COMP2221 Coursework 1 1
School of Computing, University of Leeds
COMP2221
Networks
Coursework 1: InetAddress and the IPv4 hierarchy
If you have any queries about this coursework, visit the Microsoft Teams page for this module. If
your query is not resolved by previous answers, post a new message.
Learning objectives
• Use of the java.net.InetAddress class.
• Demonstrate Understanding of the hierarchy in the IPv4 address scheme.
This item of coursework is worth 15% of the final module grade.
Task
Add to the empty class Coursework1, defined in the provided file Coursework1.java, to read in
hostnames from the command line, and perform one of the following actions:
• If exactly one hostname is given, your code should convert the hostname to an instance of
InetAddress, and print both the hostname and the IP address to the terminal. It should
also determine if the IP address is IPv4 or IPv6, and print a message explicitly stating that
the address is IPv4, or that it is IPv6.
• Alternatively, if exactly two hostnames are entered, your code should instead first test they
are both valid IPv4 addresses, and return an error message if not. If they are both IPv4, your
code should output the highest levels of the hierarchy shared by them both. For instance,
if the two hostnames resolve to 129.11.1.17 and 129.11.2.17, your code should output
129.11.*.* (not 129.11.*.17!) Only whole bytes need be considered, you do not need to
consider individual bits as in CIDR. If there are no levels in the hierarchy shared by both
addresses, your code Should return *.*.*.*, and if both addresses are the same your code
should output the common full IP address.
The file Coursework1.java is available from Minerva. You should extend and modify the class
definition in this file to satisfy the requirements. If you decide to create additional files, be careful
to follow the submission instructions.
COMP2221 Coursework 1 2
Your code should output no more information than that stated above. There should be no
interaction with the user other than via command line arguments. In particular, your code should
not use a keyboard scanner.
At no point should your code use the InetAddress methods getAllByName() or isReachable().
Your code should adhere to the coding standards described in the file JavaCodingStandards.pdf
on Minerva.
Guidance
Some methods of InetAddress were covered in Lecture 5; the full specification can be easily found
online1. Example Code using InetAddress was provided at the start of Lecture 6. You may also
like to look at the book Java Network Programming by Harold mentioned in Lecture 1.
Marks
3 marks : Correct output of the required information for a single hostname.
6 marks : Correct output of shared hierarchy for a pair of IPv4 addresses.
6 marks : Well Structured and commented code with meaningful error messages. Adherence
to the provided Java coding standard.
Total: 15
Submission
If you submit a Single file, it should be called Coursework1.java and uploaded to Minerva.
If your solution is split between multiple files, they should all be placed in the same directory. To
submit, cd to that directory and delete all extraneous files (.class, any IDE-related files etc.),
then create an archive .tar.gz file:
tar cvzf cwk1.tar.gz *
This will create the file cwk1.tar.gz that you should upload to Minerva.
The following sequence of steps will be performed when we assess your submission:
1. Unarchive the submission if it ended .tar.gz.
2. Compile all files with javac *.java
3. Execute your solution, e.g. java Coursework1 leeds.ac.uk www.comp.leeds.ac.uk
Your submission must work when this sequence is followed on a School machine, or
you will lose marks. This means that you should not have lines like ‘package ...’ in your
1e.g. https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html
COMP2221 Coursework 1 3
submission, as this Causes compilation to fail on a School machine. You should also ensure the
only input from the user is via command line arguments as above.
Disclaimer
This is intended as an individual piece of work and, while discussion of the work is
encouraged, what you Submit should be entirely your own work. Code similarity tools
will be used to check for Collusion, and online source code sites will be checked. The
standard late penalty of 5% per day applies for work submitted after the deadline.
 
如有需要,请加QQ:99515681 或WX:codehelp
  免责声明:珠穆朗玛网对于有关本网站的任何内容、信息或广告,不声明或保证其正确性或可靠性,用户自行承担使用网站信息发布内容的真假风险。
责任编辑:珠穆朗玛网