CPT120 Assignment 2-‘StoryMaker Solved

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . solution files instantly, after Payment

Description

Rate this product

Note: Please ensure that you have read sections 1-3 of this document before going further.

Assume that a children’s software developer has hired you for your coding skills to work on a project involving personalised/dynamic stories/poetry named ‘StoryMaker’. At first, the program asks the user to enter several fields such as names of characters/places, numbers of things, etc. that are important to the chosen story and then finally displays that story with the entered fields embedded (similar to the Myself program but with inputs). You must not use the given example story. You must meet the code (section 4.1) requirements and documentation (section 4.2) requirements detailed further below.

Tip: As you are not given marks for creativity, you can come up with your own story or feel free to use one found online (provide references when relevant). As this is for hypothetical children, please keep the non-changing parts of the story “tame”.

4.1) Code requirements

C1. Code presentation and format – The program must be entirely inside the main method of a Java class/file named StoryMaker.java and formatted consistently (Tip: use Eclipse→Source menu→Format before every submission). Must not include any unused/irrelevant code (even inside comments).

C2. The story/poem must be able to store at least two String fields and one number field based on the chosen story.

C3. Values for the fields must come via user inputs when the program is run. All inputs must be taken before any part of the story is shown.

C4. The final composition of the story must be in one variable and it must be displayed using one output statement. Refer to the behaviour demonstrated in the Myself and TypeDemo examples. Consider these as requirement presentations by the “client”.

In places where this specification may not tell you how exactly you should implement a certain feature, the programmer (you) need to use your judgment to choose and apply the most appropriate concepts from class materials. Follow answers given by your “client” or “supervisor” (you instructor) under Canvas→Discussions→’Assignment 1’ when in doubt.

4.2) Documentation requirements

D1. Write comments next to defined code blocks (e.g. near public static void main, ifs, etc. where you can have { }) and declared variables explain their purpose in the program and what alternatives would have been possible. Do not assume that the reader can figure these out.

E.g. with important variables, discuss which data type you have used and what other data types might have been possible/impossible and why.

E.g. with if statements (if you have them), discuss how else one might perform the same conditional check or if there is no other way, state why it would be impossible.

D2. Explain any code requirements that you have not met and all bugs (situations that might cause the program to crash or behave abnormally) in the approximate locations they originate within your code. Bugs imposed by limitations in the lesson topics such as input type mismatches need not be corrected in code but they still must be documented, if they exist. If you do not have bugs, you must explicitly say that there are none. Tip: A good programmer knows the limits of their program. If doing B2, explain any standard code requirements that you may have violated due to the bonus requirements.

4.3) The following is only an example. You must choose your own story and relevant fields.

“Enter name of big animal” (You enter “lion”)

“Enter name of small animal” (You enter “mouse”)

“Enter story duration in days” (You enter 2)

[Your code should then display in one go (similar to the Myself program shown in week 1 tutorial lesson)…]

Once upon a time there lived a lion in a forest. One day after a heavy meal it was sleeping under a tree. After a while, there came a mouse and it started to play on the lion. Suddenly the lion got up with anger and looked for those who disturbed its nice sleep. Then it saw a small mouse standing trembling with fear. The lion jumped on it and tried to kill it. The mouse requested the lion to forgive it. The lion felt pity and left it. The mouse ran away. 2 days later, the lion was caught in a net by a hunter. The mouse came there and cut the net. Thus it escaped. There after, the mouse and the lion became friends. They lived happily in the forest afterwards.

4.4) Bonus requirements (bonus marks for this assignment are capped at 1)

You can do either or both of the requirements below but to obtain any bonus marks, you must meet all requirements of the non-bonus/standard part.

B1. Submit your final version of the assignment 1 week before the deadline for +0.5 bonus marks or 2 weeks before the deadline for +1 bonus marks.

B2. By incorporating if-statements to perform conditional checks, make your story change based on the inputs. You can make it like an interactive adventure where the story is displayed progressively. If meeting bonus requirements mean that you have to violate a non-bonus requirement, explain this in your code documentation (marks will not be deducted as long as these are explained). If you choose to incorporate this bonus functionality, your bonus version is the only version that you must submit. Please do not include multiple versions of your code in the final submission. (+1 bonus marks).

Note: The total mark for assignments+weekly work (the non-exam component) is capped at 50 marks; the exam will be 50 marks. For a full break-down, see Canvas→Home→Syllabus.