Correct syntax of a common programming language

Assignment Help JAVA Programming
Reference no: EM13920284

In the process of this assessment task you will:

• Identify and use the correct syntax of a common programming language (Java);

• Describe program functionality based on analysis of a given program;

• Recall and use typical programming constructs to analyse, design and implement simple software solutions; and

• demonstrate debugging and testing skills whilst writing code.

General Requirements

• Provide evidence of code comprehension skills by answering questions relating to the starting code provided; and

• Complete the analysis, design, implementation and debugging of a small program that is pre- dominantly procedural in nature;

Understanding and Enhancement of a Simple Menu Driven Program

Application Overview

For this assignment you have been provided with incomplete starter code that you must understand, modify and add to. The system provided simulates the collection, modification and reporting of game characters. The game characters have a unique id created in the program and have a number of attributes including a health rating and a power value. The system is run within the Eclipse IDE and provides a menu through the IDE console. The user must enter a pre-defined number of game characters before any of the other functionality can be used. At present, the following menu items are working:

• Create your characters;

• Display formatted information of all characters;

• Display a particular character;

• Display total legs and power for all characters; and

• Empower your character.

One function listed on the menu is not working:

• Display entered information of all characters You must write the code for the missing function.

Additionally, there are some changes required to the existing code. These changes are required to demonstrate the variety of ways of dealing with sequencing, selection and repetition and also demonstrate your capabilities for understanding and changing the code.

PART A - Code Comprehension

The sample code provided in the GameCharacters.java class should be used to answer the following questions. Familiarise yourself with the operation of the application by running it and choosing the working options - 1,3,4,5,6:

1. Identify in the code the way in which users interact with the program. Identify the object and list the lines of code where the object is used to receive information from the user. Also list the lines of code where the program sends output to the user.

2. What is the purpose of the "\t" in some of the literal Strings presented in the code?

3. How many game characters can be entered for this system? How many attributes does each character have? Identify the three lines of code where this information is established.

4. Currently, if the user enters an incorrect menu selection, what happens? Explain why the error message is displayed and what method and line of code is responsible and why.

5. The method menuSystem() is replaced with the code below. What would be shown for option 3 - display formatted information of all characters - if you had not yet entered any data (menuSelection ==1)? Where did the information displayed come from?

6. Explain in your own words what is happening on each line of the method createCharacterCode(int x).

7. After entering the required number of game characters, choose option 3 to display formatted information of all characters and complete the following table of variable values after executing each line of the method decodeCharacterCode(int _code, int _row). Use a _row value of 1 and if a variable is not defined at any stage, use the text ‘not defined':

8. Now change the value of the FACTOR constant to 1000. Compile and run the application entering another set of game characters and choose option 3 to display the information. The code and studentID are incorrect on the report. What has gone wrong?

9. In the createCharacterCode(int x) method, line 212 has the operation almostCharacterCode = almostCharacterCode * FACTOR; What would happen if you changed the "*" to a "/"? What primitive data type is almostCharacterCode and what would a more appropriate data type be if you changed the "*" to a "/"?

10. In the displayCharacterDetails(int _a) method a switch statement has been used to assist in assembling the String that lists the attributes of each character. The break keyword is used in this switch statement. What would happen if the break statement was removed after the first case (line 297)? You should discuss what generally happens with a switch statement when you remove the break and what actually happened here from an application perspective. What java error occurs?

11. When entering characters, how many times is the createCharacterCode(int x) method executed? In the method itself, the condition if (almostCharacterCode == 0) exists. What other variable could have been used instead of almostCharacterCode to achieve the same outcome?

12. Explain the purpose of the boolean variable finished in the addPowerToCharacter () method and how it is used.

PART B - Programming Requirements

1. Provide the code for the displayAllCharactersRaw () method. You are expected to just list what has been entered by the user in "raw" form as well as the generated character code without any interpretation (i.e. the data as stored in the two dimensional array). In your solution you must use nested for loops and the constants for array dimensions. You must also only have one print statement in the outer loop detailing the attributes for the current character. This is done by using a String and concatenating to it. Look at the charAttrs variable in the displayCharacterDetails(int _a) method for an example of this.

2. Add any functionality required to allow two new power types to be added. Hint: you do not need to write any new lines of code. The power types and their values should be unique to each student.

3. In the createCharacters () method, change the while loop for obtaining the studentID to a priming read while loop. Look at your lecture notes for week 4 for information on this.

4. In the displayCharacterDetails(int _a) method, replace the switch statement with a series of if/else if combinations to achieve the same functionality.

5. In the displayTotalLegsAndPower() method replace the for loop with a while loop. Look at your lecture notes from week 5 for information about this.

6. In the obtainCharacterAttribute(String _introText, String[] _typesText, int _min, int _max) method change the while loop to a do while loop.

PART C - Testing

An important part of verifying what you have done is testing. As per your lecture notes from week 5 you should consider:

• Ensuring that the program is what the client is asking for (you have to be both client and programmer here);

• Testing the design of the program to check that it meets the requirements;
• Desk checking the code written; and
• Testing the implementation of the code.

When testing, you should be able to distinguish between syntax, runtime and logic errors. Syntax errors are expected to be eliminated before submission (Eclipse IDE helps with this). Runtime and Logic errors are also expected to be eliminated if sufficient testing has occurred.

You should at this early stage satisfy yourself and provide evidence that any changes you have made in PART B work as they should and have not had any adverse impact on other components.

As a minimum you should provide evidence of the output of the system and its various functions before the changes and evidence of this after the changes. It is suggested that you make use of tables to display the data and testing.

Attachment:- GameCharacters.rar

Reference no: EM13920284

Questions Cloud

Creating a normobaric hypoxic environment : In his paper on altitude simulation, Daniel found one source that explained that "creating a simulated altitude can be accomplished through creating a normobaric hypoxic environment. "  In his paper, Daniel uses the phrase "normobaric hypoxic envi..
Statements of the rules of debit : 1) Which of the following entries would be used to record the billing of fees earned? 2) If total liabilities are $1,000 and total assets are $8,000, owner's equity must be:
Peoria best coffee house extra credit raw : Bob Roaster, the vice president for sales at Peoria's Best Coffee Houses (located in suburban Prescott Florida) is considering expanding this company's chain of coffee houses to Tallahassee. But before he can commit to opening one or two stores i..
Identify each of the events as an asset source : Identify each of the events as an asset source, use, or exchange transaction.
Correct syntax of a common programming language : Identify and use the correct syntax of a common programming language (Java) - describe program functionality based on analysis of a given program and recall and use typical programming constructs to analyse, design and implement simple software solut..
What items need to measured to substantiate improved process : In your paper, make sure to include a description of the improved process and a "To Be" flow chart. Determine what items need to be measured to substantiate the improved process, the data required to measure improvement, and the upper and lower co..
Define lead, lag, and match strategy for capacity planning : Recommend a better strategy for the Manychip's production strategy, outlining the advantages of your proposal. Should they change from the lead strategy or not?
Why we need preprocessing of data : Why we need preprocessing of data? Explain major four data preprocessing techniques?
Describe some models for organizational process improvement : Describe some models and methodologies used for organizational process improvement. Describe the model(s) or methodology(ies) your organization uses for organizational process improvement?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd