[Please read all 4 pages of this document before writing any code]
COSC1519 Introduction To Programming Assignment 1: Chatterbot
Submission and due date: See Canvas→Assignments→Assignment 1
103097121097110046119105106101115105110103104101064114109105116046101100117046097117
Note: This is an individual assignment. All submitted work must be your own and do not even show your code to others (see RMIT Academic Integrity information). When in doubt, ask Daryl or Gayan via Canvas→Discussions. You are awarded marks based on your ability to follow and fulfill the given requirements of this assignment. Every word in this document matters. If it’s not written, it’s not a requirement but you must use the necessary concepts as shown in class materials as the list of things you must not do is too long to list. If there are changes to any requirements or additional clarifications, announcements will be made via Canvas→Announcements.
Students are expected to start on assignments upon their release and are expected to manage time and minimise risks that can prevent you in completing the work. As this is tertiary education, you are also expected to independently investigate additional examples and perform R&D that is required to complete this assignment.
Abstract
In this assignment, you will create a simplified chatbot/chatterbot using Java. In the simplest sense, a chatterbot is a program that can imitate a conversation with a human by checking the human/user input to see if there are any known keywords/topics. Like with most programming tasks, there are many ways to solve a problem but you need to ensure that you are fulfilling the requirements of this document.
This assignment has code requirements (section 1), documentation requirements (section 2) and demo requirements (section 3).
Below is a summarised timeline of deliveries required by you:
Week 4: Preliminary demo during your allocated practical (3.75 marks max) End of week 5: Final submission via Canvas (2.5 marks max)
Week 6: Final demo during your allocated practical (3.75 marks max)
Total mark for Assignment 1: 3.75+2.5+3.75=10 marks
Hints and tips will be given during the classes and the class work will help you complete this
assignment. You are expected to do the class work and the assignment simultaneously. If you need an extension, please refer to RMIT Special Consideration information. Full details in the rest of this document.
If you wish to organise special consideration, please contact gayan.wijesinghe@rmit.edu.au at least 2 working days before any due dates/deadlines.
1. Code Requirements
All stages must be completed in sequence as most requirements in stage 1 apply to stage 2 and most requirements in stage 2 apply to stage 3.
1.1) Stage 1 Functionality
Your program must follow the algorithm below:
a. Create separate variables for at least 10 built-in keywords/topics (hard-coded in your program). E.g. a keyword can be “work”. Arrays are not needed for this level (code will be lengthy – aim to do normal functionality instead!)
b. Ask the user to say something about a known topic (must show them the built-in keywords/topics in the input prompt).
c. If a known keyword/topic is in the entered user input, the computer must ask the user about that topic. E.g. if the user entered “i want to talk about work and stuff” and if “work” is the first matching keyword, the computer must ask them “Tell me more about work…”. (Note: recognised keyword/topic must be in the prompt when asking). Avoid deep conversations.
d. If the (most recently entered) user input contains a question mark anywhere, you must tell them that you (the computer) will be asking the questions. (Hint: This must be done even if a keyword is not recognised).
e. If the (most recently entered) input contains no known keyword/topic, you must repeat from b.
f. Repeat from c. until user cancels.
Restrictions: while-loops must be used for repetition. Must not use return, break or continue
statements.
Hint: Before writing your code, for ease of understanding, draw a state diagram, where some of the steps a..f in the algorithm above are the states (written inside circles) and user inputs/selections (written on the lines) will cause transitions to other states.
1.2) Stage 2 Functionality
Implement the ‘stage 1 functionality’ code requirements then modify it so that the keywords are only stored in a standard Java array. Must not use ArrayList or similar data structures. Stage 2 requires you to keep the array size fixed to 10 elements and keywords can be hardcoded to the array the same way they were hardcoded to the variables in Stage 1.
1.3) Stage 3 Functionality
Implement the ‘stage 2 functionality’ code requirements then modify it so that, each time it is run, the program asks the user how many keywords they want, creates the array to that size and takes keyboard inputs for each keyword (one at a time). Your code must work with 1 or more keywords. Must not use ArrayList or similar data structures. Numerical user inputs must be validated then and there in a justifiable way and user must be asked to re-enter until they get out of range inputs correct (e.g. you can assume that a user will enter an integer for the number of keywords; there is no need to validate String inputs). You must not have an upper limit on the number of keywords allowed.
2. Documentation Requirements
a. All documentation must be within your .java file in the form of plain English code comments. Explanations should be in your own words; do not quote external sources. Do not include any question text, unused code within your .java files even if they are inside comments. The submitted/demonstrated version should be a final product. Documentation without relevant code will not attract any marks.
b. Write comments next to important variables and explain their intended purpose in the program. Explain what other options would have been possible (e.g. with variables, discuss which data type you used and what else might have been possible/impossible.) Do not assume that the reader can figure these out.
c. Write a comment near every block of code (e.g. near public static void main, ifs, etc. where you can have { }), explaining its purpose in plain English. The comment for the ‘public static void main’ should explain the overall idea of the program and any important things to note when running it. Discuss any possible alternative approaches that would have been possible (e.g. whether something could have been done before another, etc.). Do not assume that the reader can figure these out.
d. If you have any unresolved bugs (does not include limitations imposed by learning materials such as input type validation), you must document these in the approximate locations they originate within your code. If you do not have bugs, you must explicitly say that there are none. Note: Being able to recognise bugs is a good thing.
3. Demo Requirements
Your demos must be completed in your allocated practical classes in the weeks stated below. It is your responsibility to ensure that you are ready to demo on that day on time. Please arrive to class at the start of the class and write your name on the board. If you are not there, your demo will not be marked. If you have missed your turn (e.g. due to arriving late), you may be sent to the back of the queue. Markers will not stay back after the class to mark. All classes finish 20 minutes past the final hour as students and instructors need to be on time at the next class.
3.1) Week 4 demo requirements (3.75 marks max)
For the week 4 demo, you will be marked on your ability to demonstrate and explain aspects a-d below based on your work submitted on Canvas under Canvas→Assignments→Assignment 1. You demo result may not show immediately on Canvas so it is your responsibility to ask your instructor how your demo went if you need to know then and there.
a. Use of variables, some user inputs
b. Minimal use/experimentation with if-statements.
c. Minimal use/experimentation with while-statements.
d. Must have relevant comments/documentation and code must be formatted using Eclipse→Source→Format.
Marks breakdown for week 4 demo:
3.75 marks max: Has a+b+c+d
2.5 marks max: Has a+b+d
1.25 marks max: Has a+d
0 marks max: Code does not compile or run under Eclipse without red dots/errors (yellow dots/Eclipse warnings ok).
Note: Even if you demonstrate a fully completed assignment during week 4, you are still required to do the week 6 demo in week 6.
3.2) Week 6 demo requirements (3.75 marks max)
The week 6 demo will be based on the final submission of your assignment submitted on Canvas under Canvas→Assignments→Assignment 1. You demo result may not show immediately on Canvas so it is your responsibility to ask your instructor how your demo went if you need to know then and there.
Marks breakdown for week 6 demo:
3.75 marks max: Completion of code stage 3 + documentation requirements
2.5 marks max: Completion of code stage 2 + documentation requirements
1.25 marks max: Completion of code stage 1 + documentation requirements
0 marks max: If no progress since partially complete version demonstrated in week 4.