首页 > 编程语言 >COMP282面向C#编程UGI

COMP282面向C#编程UGI

时间:2023-05-05 13:34:54浏览次数:37  
标签:COMP282 UGI C# colour should will line 10% your


COMP282 – Advanced Object-Oriented C Languages
Coursework 2 – C#
Deadline: Monday 15
th of May at 17:00
Last possible time to hand-in: Monday 29
th of May at 17:00
Weighting: 50%
Feedback: General feedback will be released shortly after the last possible time you can hand-in (see
above). Personal feedback will be released around the same time, depending on how close to the
last possible time to hand in you did hand in.
Compress your Visual Studio project into a single zip file and submit it via CodeGrade – CodeGrade is
only used to make grading easier, but it will be done by hand. In particular, you will not get feedback
when submitting. Penalties for late work will be applied in accordance with the Code of Practice on
Assessment. You can submit multiple times. If you submit more than once, we will only look at and
mark the most recent, and late penalties will be based on your final submission.
Project Overview:
You will create a small Windows GUI application to draw lines and find their intersections. The
project consists of several tasks, which you should tackle in order (except for the hard tasks at the
end where any subset can be done, and the order is not important). Each non-hard task builds on
the previous one. Do as much as you can and then submit your project.
Read through this entire document before you start coding, so you are aware of all the tasks and the
overall structure of the program. In particular, if you are aiming for all tasks, look especially at the
last one, because otherwise you will likely need to redo quite a bit. Your solution should
demonstrate your knowledge of C# and GUI development with Visual Studio.
Note: Much of the code will be generated for you by Visual Studio. We’ll mark the code you write.
User Interface & User Experience Design
Your application should look something like the screenshots shown on the next page. It doesn’t have
to be identical, but it should have equivalent controls and buttons.
The solution is shown working and discussed in the accompanying video. Please watch this to get a
good idea of how your application should behave.
Runtime errors gives down to -20%
If your program makes multiple distinct obvious runtime errors, you lose 20% (down to at least 40%)
– meaning it keeps crashing even if you do not try to find errors. If your program makes some subtle
runtime errors, you lose 5-10% (again, down to at least 40%) – depending on how subtle.
Solution without the last task
Solution with the last task
Part 1 (Worth 15%)
Task 1 – Line Class Definition (5%)
Create a Line class that stores two points and a line colour. Implement a constructor that takes
appropriate parameters and stores them in the object. Also, implement the appropriate C# property
getters and setters (incl. appropriate access modifiers). Finally, override the ToString() method for
the class so that it outputs information about the two points (we will output the line colour in some
other way).
5%: Created Line class
Task 2 – Form Layout (10%)
Use the Visual Studio layout designer to create a form similar to one of the onesshown above. At this
stage, the application should be runnable. Also, set up the design so that it is nice to work with, incl.
tab order and names of elements. When it’s run, the form window should be displayed without any
build errors, although it will not do anything apart from terminate correctly when the user closes the
window.
10%: Made a nice layout
Part 2 (Worth 65%)
Task 3 – Adding Lines (5%+5%=10%)
Use a relevant C# container class to store Line objects. Implement the code that runs when the user
clicks the Add button. Your code should retrieve the text entered into the First X, First Y, Second X
and Second Y boxes and convert them into a Line object (with some reasonable default colour). You
should also update the GUI so the added lines appear in the large picture box area as well as the list
view box (or similar). Use the format shown above on the previous page (or similar). If something is
not entered correctly, make a suitable error message.
5%: Implemented Add button
5%: … with suitable error messages
Task 4 – Drawing lines (10%)
Every time you click twice in the picture box, a line should be drawn between the two points defined
(it is easier and seems more sensible to do it on MouseUp, but you can also do it on click). This task
is about implementing that functionality. You should add the created Line object to the picture box
and the list view box (or similar).
10%: Can draw lines
Task 5 – Changing colour (5%)
You should implement the Color button. It should show a ColorDialog and then, if the user selects
OK, change the default colour (i.e. the colour used in future lines) to the chosen colour. It should also
set the Forecolor of the Color button to be the chosen colour.
5%: Implemented Color button
Task 6 – Removing lines (5%+5%=10%)
Your code should find out which item in the list is currently selected (represented by the blue
background) and remove it, when the Remove button is clicked. Also, set the selected index in the
list to be an adjacent line. Make sure you remove the item from the list as well as the picture box. Be
sure to check the index of the removed item to prevent runtime out-of-bounds errors and display
suitable error messages if there are problems.
5%: Implemented Remove button
5%: … reasonable error messages and the index updates in a sensible manner afterwards
Task 7 – Updating Lines (5%+5%=10%)
When the user clicks on an item in the visible list (or uses the keyboard to move up and down the
list), the text boxes should be updated to reflect the current selection and the Forecolor of the Color
button should be set to the colour of the selected line.
Implement the code that runs when the user clicks the Update button. Your code should update the
currently selected line with whatever is currently in the text boxes. You should update both the list
as well as the picture box. Again, make sure you do not get runtime out-of-bounds errors and make
suitable error messages if there are problems.
5%: Implemented Update button (with error messages)
5%: Change fields to be the content of the selected row on click
Task 8 – Find intersections (10%+10%=20%)
Add the code that runs when the user clicks the Find Intersections button. You should calculate the
intersections between each line and show a circle around every point intersection and a line if the
lines overlap in a line, in both cases using the default colour. There is a nice algorithm by Samos and
Huey for this, running in time O(n log n + k), if there are n lines and k intersections, but you are just
expected to use the naïve O(n2
) solution where you try all possible pairs of lines (partly because
Visual Studio 2019 does not have priority queues – the new version does).
If you can not remember how to find the intersection of two lines, you can look at:
https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
Note though that it just solves the case where they meet in a point and you will need to do
something else if you want to find the line overlaps. You get 10% if you get it to work reasonably
well (i.e. what you would do if you only looked at that Wikipedia page) with the last 10% if you
actually get it fully working.
10%: Implemented Find Intersections button with basic behaviour
10%: Find Intersections works fully correctly
Part 4 (Worth 10%+10%=20%) – Make the list a data grid view (or similar)
Task 9 – Data grid view
Change the list view or similar to be a data grid view. When done correctly, it should let you add/edit
lines by simply clicking on them on the list and changing the content (new lines would be added by
making a new line at the end) and therefore you can remove the corresponding buttons. You should
be able to change the colour by entering/clicking on the Color field of the row (i.e. display the
ColorDialog) and its current color should be displayed as the background colour of that row (so you
would not change the Forecolor of the Color button). To be concrete, the line should be added when
all entries of a row are of the right type (and the user has done editing – i.e. when CellEndEditing is
called) and be updated when all entries are of the right type (and the user has done editing) – if the
user does not update a line correctly, use the line before they started these edits.
10%: Used a fair implementation of a data grid view
10%: Did not make any errors
How to Submit
Locate your Visual Studio project folder and compress it into a single .zip archive. If you use any
other format we won’t be able to extract and mark your work.
Rename the zip file to be your student id (and then .zip).
If you want to draw our attention to anything, make a comment in the code itself. We will not read
or mark any other documents.
Submit your archive via CodeGrade.
Marking Descriptors
We draw your attention to the standard Department Grade Descriptors, which are listed in the
Student Handbook.

 

标签:COMP282,UGI,C#,colour,should,will,line,10%,your
From: https://www.cnblogs.com/tongu1/p/17373853.html

相关文章

  • stm32 cubeide ST7920 12864点阵屏 U8G2移植
    准备工作【通用-移植u8g2准备工作】在cubeide中移植u8g2到STM32的准备工作源码获取和文件处理-不打鱼光晒网-博客园(cnblogs.com) 7920很老了,spi只能接受2.5M的时钟,实际上2M就大概率花屏了,使用硬件spi的话,由于分频系数选择的问题,配置为1M就行了,不然花屏7920的穿行模式仅......
  • Linux Centos7内核升级
    LinuxCentos7内核升级现在主流的centos应该都是centos7了,从centos7.2开始,内核版本为3.10,越往后内核版本越高。高版本的内核修复了许多的低版本内核的bug,因此,系统是需要提高内核版本的,从而提高安全性,稳定性,并增加更多的功能。Linux是支持多版本内核共存的,无非是系统启动的时候应......
  • 注册表RootKey简写:HKCR, HKCU, HKLM, HKU, and HKCC
    WhatDoHKCR,HKCU,HKLM,HKU,andHKCCMean?(RegistryRootKeys)By Rich Note: TogetabetterunderstandingofWindowsRegistrybasics,read thisguide.Ifyou’resomewhatfamiliarwiththeWindowsRegistry,you’venodoubtseenreferencestoHKCR,HKCU......
  • 在 linux-4.9/drivers/usb/serial/ch341.c 上串口收发数据异常
    有天做USBhost串口驱动的时候发下FT\CP都没有问题,就CH341有问题,读写正常,但数据不正常。有一点稀奇,可能是ch中间有版本变更了吧。解法就更新到https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c最新的代码就行,有一些函数有出入,但大体影响......
  • Educational Codeforces Round 147 (Rated for Div. 2) (贪心)
    原题链接:https://codeforces.com/contest/1821/problem/D*题意:从1开始走,走的给定区间的值要k次。且shift按了要松开,代表走了一个区间除了往右的次数,还要多两次按shift的次数,求最小次数。*思路:1.先把不可能的情况列出来,就是给出的区间大小小于k时直接输出-12.我的思路是暴......
  • Aria2 下载工具部署(local)
    Aria2下载工具部署(docker)中介绍了使用docker部署Aria2的方法,如果已经安装了docker,执行起来是比较简单的。但如果觉得每次使用Aria2还需要启动docker这个操作有点重,可以考虑使用本地部署的方式。这里使用scoop安装aria2和ariaNgScoopInstaller/Scoop:Acomman......
  • 快速高效的C#FTP文件传输库FluentFTP
    简介:FluentFTP是一个用于C#语言的FTP客户端库,它提供了许多方便的功能和API,使FTP文件传输变得简单易用。FluentFTP的主要目标是提供简单易用的API,并同时提供足够的灵活性以满足大多数开发人员的需求。FluentFTP支持FTP和FTPS协议,可以通过简单的API进行连接、上传、下载、删除、重......
  • CSC8016用户场景
    CourseworkCSC8016UseCaseScenarioWewanttoimplementavirtualshoppingsystem,whetherthethreadsareeitherclientsusingthewebapp,orclientsbuyingproductsonthephysicalshopusingthemobileapp.Thelifecycleofanyclientinteractionissum......
  • C#处理医学影像(四):基于Stitcher算法拼接人体全景脊柱骨骼影像
    在拍摄脊柱或胸片时,经常会遇到因设备高度不够需要分段拍摄的情况,对于影像科诊断查阅影像时希望将分段影像合并成一张影像,有助于更直观的观察病灶,以下图为例的两个分段影像:   我们使用OpenCVSharp中的Stitcher类的Stitch方法,导入两张图像并拼接: 但结果却失败了,返回错误......
  • [Oracle] 收缩表,释放空间
    收缩段消除空间碎片的方法有两种:方法1:使用Move命令altertabletable_namemove注意:1)move操作会锁表。(如果是很小的表,可以在线做。如果是大表一定要注意,会长时间锁表,只能查询,影响正常业务运行)2)move操作会使索引失效,一定要rebuild。(因为move操作会改变一些记录的ROWI......