Professional Documents
Culture Documents
Draft Aina Najwa Binti Razali Assignment SC025 Set 2
Draft Aina Najwa Binti Razali Assignment SC025 Set 2
F2T8
DRAFT ASSIGNMENT SC025
Pseudocode
Start
Counter = 0
Read n
Declare, create, initialize array (chemical solutions[n], pH values[n])
While (counter<n)
Read chemical solution[counter]
Read pH values[counter]
Counter = counter + 1
End while
Read pH to be search
Counter = 0
While (counter < n)
If (pH value to be search = pH values[counter])
Display chemical solutions[counter], pH values[counter], index location
Else
Display “Chemical solution not found”
End if
Stop
Flowchart
Java code
//Assignment SDS SC025 Session 2021/2022
//Author name : Aina Najwa Binti Razali
//AINA NAJWA F2T8 ASSIGMENT SDS SC025 SESSION 2021/2022 SET 2
import java.util.Scanner;
class F2T8Assignment{
public static void main(String[] args){
No value found
for (counter = 0; counter < n ; counter = counter + 1){
if (phValueToBeSearch == phValues[counter])
{
System.out.println("Chemical solution " + chemicalSolutions[counter] + " with pH value
" + phValues[counter] + " present at index " + counter);
}
else
counter = counter + 1;
if (counter == n){
System.out.println("Chemical solution not found");
}
}
System.out.println("******************************************************");
}
}