[Solved] Assume you have written a Java program

$25

File Name: Assume_you_have_written_a_Java_program.zip
File Size: 357.96 KB

SKU: [Solved] Assume you have written a Java program… Category: Tag:
5/5 - (1 vote)

Java programs tend to have three types of errors: javac compiler errors, syntax errors, or logic errors. Javac errors are usually related to misspelled commands, filenames, or improper installation of Java, whereas syntax errors are generated by the compiler. When you compile a program, sometimes one syntax error may generate multiple error messages and sometimes multiple syntax errors may generate only one error message. Programs with logic errors will compile cleanly but will not provide the correct output for a given input. These logic errors are often more difficult to find and fix than syntax errors.

In programming, there are many strategies available for solving such errors or problems. The five-step approach is one of the most common. These five steps include:

  1. Specify the problemidentify the problem as specifically as possible. Be sure to include details of what you want to accomplish (the goal state).
  2. Analyze the problemlearn as much as you can about the problem. Some techniques that can be used in this step include brainstorming, research, and talking to other people about the problem.
  3. Develop a set of possible solutionsusually there is more than one way to solve a problem. Using the same techniques as in Step 2, think of possible solutions. It often helps to consider how you solved similar problems in the past.
  4. Evaluate possible solutionsweigh the strengths and limitations of each solution you discovered in Step 3.
  5. Choose a solutionconsider several factors such as time required, financial cost, practicality, and so forth.

When you write a Java program in this course, you typically start with a template that you have copied and pasted from a previous program into your Java editor. You then modify this template to create the code you need. Usually, the code will start with some information that is input into the program (via user keyboard input for simple programs or later by reading a data file). The program then processes the information and creates output (once again, simple programs send output to the screen, more complex programs may send output to the file and error messages or confirmation messages to the screen).

For this Discussion:

Assume you have written a Java program that takes four input variables (integerOne, integerTwo, integerThree, integerFour) and calculates an output variable (resultOut) using the following formula: resultOut = (integerOne + integerTwo) * integerThree integerFour .

Using your text and/or the Internet as a resource, list three different types of syntax errors the Java compiler may find in your program. Then, use the five problem-solving steps listed above to determine how you will fix each type of error. Be sure to clearly highlight the five steps within your posting.

Finally, assume your program compiles cleanly with no syntax errors. You input the values 2, 3, 4, 5 and the valueOut is computed to be 17 (it should be 15). Specify how you will use the five problem-solving steps to find the logic error.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Assume you have written a Java program
$25