Java Programming Practice Sheet
Java Programming Practice Sheet
Class Assignment
IGCSE Grade 10
Date : 24-11-2023
a. Write a short java program using a while loop to allow the user to input
the weight of sacks of rice and to count the number of sacks the user has
input. When the user types in ‘-1’ this should stop the process and the
program should then output the number of sacks entered and the total
weight.
b. Develop a Java program that computes and displays the highest, lowest,
and average scores for 20 students in six subjects.
The program should prompt the user to enter their name, subject and
the scores for each subject, with each subject comprising five tests, each
scored out of 100.
The program should ensure that the entered scores fall within the valid
range of 0 to 100.
The program will display the student name ,highest, lowest, and average
scores for each subject across all five tests.
c. Write a java code to implement a linear search to find the record for
the specified employee ID number in the array EmployeeRecords[10].
The algorithm should efficiently search the unsorted list of employee ID
numbers and return the index of the matching record or inform the user
that the record was not found.
input two integers a and b and then find a MOD b and a DIV b
create a random integer between 100 and 300.
g. write and run a short program to input your full name into a variable,
MyName, find the length of your name, extract the first three
characters of your name and display your name in upper case and in
lower case.
h. Write a java program to use a nested FOR loop to output the numbers 1
to 5 twenty times.