Array Sort (Ascending Order) Practical Test: Prepared By: Mr. Argel Pascua

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

Array Sort

(Ascending Order)
Practical Test

Prepared by:
Mr. Argel Pascua
int number [ ];
number=new int [max]
num.length
import java.util.Arrays;
import java.util.*;
Create a program that will input
the maximum number or index
of array, and value of an array
element that will be based on
the maximum value and print
numbers in ascending order.
STEPS IN MAKING
AN ARRAY

Import Required Packages.

import java.util.*;
STEPS IN MAKING
AN ARRAY

Declare all needed


variables.
int i=0, y=0, max=0,
num[];
STEPS IN MAKING
AN ARRAY

Create Object for Scanner


Class.
try{
Scanner scan=new Scanner(System.in);
STEPS IN MAKING
AN ARRAY

Get the maximum number


of inputs for the elements of
array.
System.out.print("Enter Maximum: ");
max=scan.nextInt();
STEPS IN MAKING
AN ARRAY

Initialize the index of an


array.

num=new int[max];
STEPS IN MAKING
AN ARRAY

Get all elements of an array.

Use for statement.


STEPS IN MAKING
AN ARRAY

for(i=0;i<num.length;i++)
{
System.out.println("Enter Numbers to Sort: ");
num[i]=scan.nextInt();
}
STEPS IN MAKING
AN ARRAY

Call functions which


performs array sort.

Arrays.sort(num);
STEPS IN MAKING
AN ARRAY

Print all Array Elements in


Ascending Order.
STEPS IN MAKING
AN ARRAY

System.out.println("Sorted Value");

for(y=0;y<=max;y++)
{
System.out.println(num[y]);
}
}catch(Exception e){}
What appropriate looping

statement could be used in

printing the elements of array?


Why is it needed to
import required
packages?
How will the student
benefit from learning
the process of
sorting?
PRACTICAL TEST
The student will perform array sort.

Problem Set:

Create a program that will input


maximum size of an array, elements
of arrays and display the sorted
values in ascending order.
Criteria 5 3 1
1. Readability Extensive documentation with Info Some documentation No Info about
about programmer, overall Info about programmers, programmer, program
program function and interim program function function
comments to describe the steps in provided
each function module
The program uses structured The program uses reasonable The program is very
2. Efficiency programming effectively and fits a length of code inefficient and lengthy.
reasonable length of code
The program fulfils the The program adheres to part of The program does not
3. Usability requirement of the question and is the question and is partially solve the original
correct correct problem or is incorrect
The program contain all the The program contain measures The program contain
4. Robustness necessary measures that will cater that will cater all users’ erratic measures that will cater
any possibility of users’ erratic interaction all users’ erratic
interaction interaction

Runs smoothly and without Runs but with some glitches Still contain error or
5. Run without glitches warning.
error

Program is according to the Program follows the original Program is completely


6. Correct original question and gives partially or gives some incorrect.
correct output incorrect output
Quiz
Click the Quiz button to edit this object
Topic: Array Sort (Descending Order)

Guide Questions:

1. What is the process in creating array sort in


descending order?
2. How to perform array sort in descending order?
3. Why is the important to perform sorting in
descending order in terms of computer
applications?
Thank You!

You might also like