BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C++代写|BEng Biomedical Engineering Object-Oriented Programming Coursework 3

C++代写|BEng Biomedical Engineering Object-Oriented Programming Coursework 3

这是一篇来自英国的关于利用C++进行生物医学问题的面向对象设计和编程实践经验的C++代写

 

Objective

To gain practical experience of object-oriented design and programming using C++ on a biomedical problem.

Introduction

A robot arm is being developed for use in surgery. The model can be used to control either one device or two devices. Different kinds of device can be attached to it. For this example, either a needle or a blade can be attached.

For each device that the arm controls, the tip traces out a trajectory of (x, y, z) coordinates. We will assume that these are measured in mm and that the measurements are sampled once per second. A schematic illustration of the first few points of a trajectory is shown on the right.

A device trajectory’s point coordinates define a sequence of steps in space. Depending on some properties of the trajectory, we can decide if the trajectory is ‘safe’ or ‘potentially unsafe’. In this toy example, if a device moves more than 55mm in total over its trajectory, then it is considered potentially unsafe. Other safety criteria are specific to the kind of device used. For a blade, the trajectory is potentially unsafe if the length of any single step along the trajectory is more than 5mm (this would mean an instantaneous speed of greater than 5mm/s). For a needle, the trajectory is potentially unsafe if it turns more than 45 degrees between successive steps (this is considered to be a turn that is too great).

Instructions

Your task in this coursework is to design and write a C++ program to read data for an arm’s device trajectories and to report some information on them.

The input to your program should be a file containing trajectory information for a robot arm. You will be provided with several examples of such files, and the basic format of each file is shown

below:

TYPE

x0 y0 z0

x1 y1 z1

x19 y19 z19

where TYPE is a string indicating the type of device. We will use ‘BLADE’ for a blade and ‘NEEDLE’ for a needle. This is followed by a sequence of (x, y, z) coordinates of the points along the trajectory. The number of points may vary between files.

If an arm has two devices, then the file contains all the information for the first device followed by all the information for the second. In other words, the format will be:

TYPE

x0 y0 z0

x1 y1 z1

x19 y19 z19

TYPE

x0 y0 z0

x1 y1 z1

x19 y19 z19

Your program should read in the data in a file and store it in appropriate class(es). It should be able to handle whether the arm has one or two devices and for each device, it should be able to calculate the total distance travelled and the average speed. It should also determine whether each trajectory is safe or potentially unsafe.

For a given data file, the program should display a description of the arm’s device(s), the trajectory information and whether or not it is is safe. For example, for the file dataset1.txt, which has one blade device, the output should be similar to the following:

Arm with 1 device

Device 1:

Device type: blade

Distance moved : 50.18 mm

Average speed : 2.64 mm/s

Trajectory is safe

You are encouraged to make up your own data files, different from those provided, to further test your code.

You are also encouraged to ensure your code can at least handle files containing a single device, as this would allow you to implement the bulk of the expected functionality.

Useful hints

To help you load the data files correctly, note that std::ifstream provide the .fail(), .eof() and .clear() methods, which can be used to inspect and reset the status of operations. For example:

std :: ifstream

in (” filename .txt “) ;

float x;

in >> x;

if (in. fail () ) {

// our attempt to read a float failed

// this could be because the next token in the file

// is non – numeric text that can ’t be interpreted

// as a number

}

if (in. eof () ) {

// we have reached the end -of – file ;

}

// Reset the state of the stream to clear all errors .

// This is required if you wish to keep reading ,

std :: ifstream

in (” filename .txt “) ;

float x;

in >> x;

if (in. fail () ) {

// our attempt to read a float failed

// this could be because the next token in the file

// is non – numeric text that can ’t be interpreted

// as a number

}

if (in. eof () ) {

// we have reached the end -of – file ;

}

// Reset the state of the stream to clear all errors .

// This is required if you wish to keep reading ,

Note also that the stream itself can be directly used as a condition value (i.e. as a bool). This is often used to check for errors when attempting to open a file:

std :: ifstream in (” filename .txt “) ;

if (! in) {

// some error occurred

}

Recall that the extraction operator (>>) also return the stream, and since the stream can be used as a condition value, this allows for useful constructs of this form:

std :: ifstream in (” filename .txt “) ;

float x;

while (in >> x) {

// keep reading floats until some error occurs

}

Reporting Requirements

You should submit a C++ project that meets as many of the requirements as possible.

You should also submit a short written report explaining your object-oriented design. The report should include a UML class diagram and a short explanation of the meanings of the class(es),attribute(s) and behaviour(s), as well as a brief description of the object-oriented design process that you went through to produce your design.

To help you in producing this report, a sample model report will be made available to you through the KEATS system (called Sample model report for coursework 3 ).

Your report should not need to be longer than 3 pages of A4, and can be shorter.

Submission will be via the KEATS system.

The submission point will only allow you to upload a single file so you should combine all files into a single ZIP file. Please make sure your ZIP file does not contain any executables! The submission system’s antivirus protection tends to reject anything it detects as containing executables due to concerns around malware, etc. On CodeBlocks, you can remove all executables and object files from your project using the BuildClean menu entry (there will be similar functionality in other IDEs) – please run this before creating your ZIP file.

The hand-in date is 14 April 2023, 5 pm.

Late submissions (within 24 hours of this deadline) will be accepted but 10 raw marks will be deducted from the coursework mark. If the deduction takes a student below the pass mark, the coursework mark will be capped at the pass mark. Work submitted after the 24-hour deadline will receive a mark of zero.

If your program does not meet all requirements then please submit what you have written by the deadline.

Assessment

Your coursework will be marked on a number of factors:

  • Does the program work? Does it meet all requirements? Has it been tested extensively? (50%)
  • Program design and appropriate use of C++ language features, e.g. functions, classes, composition/aggregation/inheritance as appropriate, etc. (30%)
  • Written report (15%)
  • Use of comments, indentation and variable/function names to make code easy to understand (5%)

The overall mark for this coursework will make up 30% of your total mark for this module.

This is an individual assignment. You are not permitted to work together with any  other student. Note that general discussions about design decisions and/or coding strategies are permitted, and such discussions can be a useful learning experience for you. But you should not,under any circumstances, share details of designs or code.

bestdaixie

评论已关闭。