Project #32005 - Java Programming Discussion Question

NO PLAGIARISM!!!!!!

 

Week 2 DQ 1

 

Write a 200- to 300-word short-answer response to the following:

•What are the three types of errors that you can encounter in a JavaTM program? Describe them, and explain how you would minimize the errors. What are some examples of errors that you have seen before?

 

Week 2 Response #1

 

Write a logical response to the posted DQ below.  (200 word minimum) 

 

there are generally three errors when dealing with  a Java program, these are syntax, runtime, and logic errors.

Syntax errors are usually caused by mistakes in the programming language. These mistakes can include spelling errors in the function commands, missing or incorrect semicolons, brackets, or other required figures, or format errors in selection or loop statements.

Runtime errors are caused when a program with no syntax errors asks the computer to perform a task that the computer is unable to perform reliably. The most common tasks found are trying to divide by a variable that contains a value of zero, or trying to open a file that doesn't exist.

Logic errors are the most difficult to find because they are caused by design flaws within the program and can be located anywhere. Some common types of logic errors are mathematical errors such as subtracting instead of adding, displaying an incorrect message, or using data from the wrong file.

It is important to check your programming as you go to prevent mistakes but inevitably there will be mistakes somewhere in programming. By being able to recognize the type of error, you should be able to focus on the cause of the error, locate the problem within the programming, and correct it properly.

 

Week 2 Response #2

 

Write a logical response to the posted DQ below.  (200 word minimum)

 

Program writing involves three steps which consist of typing the code, checking the program, and executing the program. During the process of creating a program, mistakes are bound to happen due to the difficulty involved with writing programs. There are three main errors that programmers tend to deal with the most. One is Syntax errors, which involve rules of the language being violated in some way and causes the compiler to inform of the problem and where the problem exist. The process for minimizing syntax errors is having a good development strategy such as adding small amounts of codes at a time making it easier to determine where the problem exists. Next is the runtime error, which is when a computer program performs an illegal action and stops' running which is to say it is caught in an infinite loop or recursion. In order to minimize this error, add this print statement "entering the loop" immediately before the loop and the statement "exiting the loop" immediately after the loop. The last error programmers deal with is Logic errors. In this error, we tend to give directions incorrectly such as saying "place the chair to the right of the table and we really meant to place it to the left, which makes absolute sense but is logically incorrect because it fails to do what it is intended to do.

 

Week 2 Response #3

 

Write a logical response to the posted DQ below.  (200 word minimum)

 

There are three types of error.  One is the logical error. where the program does not produce the results that is expected on it. 

The steps to calculation an arithmetic expression or transposing an operand.  If a wrong operand is used then your calculations would

be off. Logical area are discovered after the program is compiled. Logical area can be detected by performing a paper test to see how the data is flowing through the program.   Another type of error is a syntax error.  A syntax error occurs when an a mark  such as semi colon The errors are usually

discovered during compiling time because it stops the program from compiling and shows an error.  The most common syntax error is putting an semicolon

at the end of a statement.  All statements in Java must end with a statement.  The error must be corrected

for the program to successfully run. Syntax error can be avoided by performing the debugging phase.   An programmer must adhere to the programming procedures for the language that he is using.  Errors that occur doing debugging, the debugging stage runs a program via the JVM to discover are there any syntax error.  The debugging phase is a safeguard against syntax error through the compiling phase.

 

Week 2 DQ 2

 

Write a 200- to 300-word short-answer response to the following:

•A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields. Choose a category (such as animal, vehicle, and so on) and describe how you would design a class for it.

 

Week 2 Response #4

 

Write a logical response to the posted DQ below.  (200 word minimum)

 

Using the example of an animal in reference to encompass class, sub, and super with additional fields if constructor) creation of new instances, same class as constructor) accessor ( returns variables starting  "get "  ), and mutator  ( alters variables ( starting set ) .

 

Class Fox

  Private static string animaltype = "vulpine";

  Private string foxColor;

  Fox  {string colorin}

   (

         setFoxscolor {colorin};

  (

  Public string getFoxcolor{}

  )

    Return this.foxColor;

 )

Public String setFoxsColor{}

  (

   This.foxColor;

}

Public static void main {string{} argsin}  {

   Fox giggles = new fox{"arctic"};

  }

}

 

Constructor would be line four for Fox

 Accessor is the get aspect (line eight )defining getFoxsColor

Mutator altar's variables and requires start of set, which is line 12 setFoxColor

The strings would be attributes of the class, in this case the class " fox " with the attributes being color and animaltype. With the strings set to private it requires the use of accessor's an mutators to ensure encapsulation and keeping objects themselves secure. Since the access is within the class itself and not outside of it this allows for the variable use

 

Another way of looking at it is like being physically in a room and having an object, such as a chair, Being with in that room one can interact due it being with in the room that encompasses the chair.  Physically being outside of the room allows the view and understanding of the object, though no changed to be made to it.

 

Week 2 Response #6

 

Write a logical response to the posted DQ below.  (200 word minimum)

 

I would create a java file named Vehicle.  The class is a private class named 

Vehicle. The attributes of the class are makeOfCar and typeOfCar.  An accessor 

named Automobile will access the Vehicle class with an get command.  Once the 

Automobile accessor has access the Vehicle class attributes, the Automobile will 

assign the model of the car the value of the car that a dealer enters and the type the dealers 

 Enter.  The values are then assigned to the value of the Vehicle class.  A class must be named after

 The name of the File.  A method that gets its value from another class is called an 

accessor.  a mutator would be used to change the value of the private object.  It is god programming practice to

set a private object with a mutator before getting the value with a accessor statement.  Giving Vehicle a private class makes

it unaccessible by other others in the program unless they access it with an accessor.   If there are any changes that need to made

to the object value or to add value to it.  It must be done by a mutator. The purpose of Object oriented data is to hide as much as the

 

information from the users as possible these methods achieve hiding the manipulation of data behind the scenes.

 

Subject Computer
Due By (Pacific Time) 05/30/2014 12:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy