Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CS 3500 – Programming Languages
Coursework 1 – C++
What to submit: You are meant to submit 10 files (ordered by which task asks you to start implementing them) – in each case, you are meant to submit a .h file and the corresponding .cpp file for each of the below:
Note, submitting the .h file is mainly meant to be a help for you, since it will let you add in other methods and so on into the classes if you so wish and a baseline .h (except for TuringMachineState, where part of the task is to write one) is provided that contains everything required, but again, you may wish to add more. You should in general not remove anything from the .h files however, since, as mentioned, they just contain the code required for each task. You may add in any number of additional method/constructor/similar you wish, but if it is not required to have a constructor and you add one, also add in an empty constructor, because otherwise the way it will be marked might fail and you will lose points. Besides the mentioned files you submit,your program will be compiled with two additional files, namely TuringMachine.h and Main.cpp (the latter only intuitively – it will really be compiled with a subset, depending on which task you completed – this is to ensure that you can get points for having done e.g. only the first task, even though the Main file provided will require all parts to be done). Penalties for late work will be applied following the Code of Practice on Assessment. Your grade and penalty are based on your last submission.
Work alone: You must work alone on the assignment. Plagiarism checks will be run!
Tests and grading: Each task will have associated some public tests and some private tests (besides the final task, task 9, which will only have private tests). The public tests are described in secondary files, one for each task, but you will be graded based on how you do on the private tests (mainly to ensure you are not hardcoding the answer, except for the last task, task 9, where figuring out what to look for is also important). Each task also gives some % of the mark for this assignment, mentioned in the title of the task.
You will be told (by CodeGrade) which of the public tests you passed whenever you submit – it will take a few minutes to run, depending on the number of people trying to submit at the same time. You are therefore heavily suggested to submit a number of times – before the deadline – and change your submission based on how it went! Your grade will be based on the outcome of the tests on your last submission.
The compilation of your code will be done using clang++ with the options:
-Wall -std=c++11
The former gives more warnings, and the latter ensures you can only do C++11 as is the case by the baseline setup of Visual Studio 2019 you were meant to install/which is installed in the labs.
Tests cannot be done without some assumed behaviour. Some of the tests for different tasks (both public and private) assume that you have done the earlier tasks.
If you have not, it is unlikely that you can succeed on that test/task. This was kept to a minimum, but still necessary at times. Each task will tell you which previous task (if any) you need to have done.
Project Overview
You will create a small interactive program to input a Turing Machine and run it, while being able to display the tape and current state). The project consists of 9 tasks, see below. It is likely easier to do the tasks in order (and besides that, as mentioned, some of the tests for some of the tasks assume this has been done). Each task builds on the previous ones. Do as much as you can and then package your project for submission. Begin by downloading the Visual Studio project template for this assessment.
Read through this entire document before you start coding, so you’re aware of all parts and the overall structure of the program. Your solution should demonstrate your knowledge of C++. Important: Each task requires you to add extra code and each part is expected to work also at the end.
Create a TuringMachineState class (incl. both a .h file and a .cpp file) that stores:
Note, while the parameters describe some requirements for the different parameters,you do not need to check that, but may simply assume that the input is such.
Declare and define a public constructor TuringMachineState that takes each parameter, in that order, and stores them in the object.
Create also public methods: getCurrentState(), getCurrentContent(), getNextState(), getNextContent(), getMoveDirection(). They should return the value of the corresponding parameter.
Implement the << and >> operators so you can output and input a Turing Machine state object with the following string format:
2 5 4 3 ->
In other words, the Turing machine states are output/input by outputting/inputting the parameters in order. For this task, you do not need to do any input validation or error handling. Assume the input has been validated elsewhere. For obvious reasons, you should do task 1 before this one.