Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
10 views

Java Programming Practice Sheet

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Java Programming Practice Sheet

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

d. Write a java code to implement a bubble sort algorithm to sort the


product records in chronological order by their name. The code should
efficiently sort the list of product records and ensure that the records
are arranged in ascending order based on their product names.
e. Write a java code to write a line of text to a file and read it back from
the file.

f. Write and test a short program in your chosen programming language


to:

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.

You might also like