Learning Goal: I’m working on a java question and need the explanation and answer to help me learn.

2 Marks

Learning Outcome(s):

Develop a program based on specification using programming language elements including syntax, data types, conditional statement, control structures, procedures and arrays, objects and classes

Demonstrate Integrated Development Environment (IDE) for the editing, building, debugging, and testing of programs.

Question One

Write a complete Java program that do the following:

  • Read your students ID number, store it in an array named myStudentNO and print it.
  • Copy all the elements in another array (arr2) but in reverse order and print them on screen using enhanced for loop.

Note: Your program output should look as shown below

Note: you should Include the screenshot of the program output as a part of your answer and you should enter your student id number. Otherwise zero marks will be awarded.

Answer:

3 Marks

Learning Outcome(s):

Develop a program based on specification using programming language elements including syntax, data types, conditional statement, control structures, procedures, arrays, objects and classes.

Question Two

  • unspecified number of integers, determines how many positive andnegative values have been entered.

Note:

  • The class name of your Java program must be your first name.
  • Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
  • The class name of your Java program must be your first name.
  • Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.

Typical run of the program

Answer:

3 Marks

Learning Outcome(s):

Develop a program based on specification using programming language elements including syntax, data types, conditional statement, control structures, procedures, arrays, objects and classes.

Question Three

Write a complete Java program that asks the user to enter the weather temperature of a city, then displays its category based on Table 1.you must do the following requirements:

  • Create a java method to print the users name, weather temperature and its category based on Table 1. The method accepts the users name, weather temperature as parameters and has no return value.
  • Call the method you created above in the main method.

temperature

Category

Below 15

cold

15–30

Warm

Above 30

Hot

Table 1

Note:

Typical run of the program

Answer: