Showing posts with label java arrays. Show all posts
Showing posts with label java arrays. Show all posts

Thursday, October 9, 2008

Exercise Problems in Java Programming

Array Problems

for DIT111

Write a program that will accept 20 integer numbers in an array. Determine and display all the even numbers. Display also the first and the last element of the array. Class name is ArrayDIT111xxx.

for DIT112

Write a program that can accept five integers in an array. Display the integers from first to last, and then display the integers from last to first. Class name is ArrayDIT112xxx.

for DIT113

Create a program that will accept 20 prices of an item and store it in an array. Compute and display the sum of all prices. Display all the values less than 5.00. Calculate and display the average of the prices, and display all values higher than the calculated average value. Class name is ArrayDIT113xxx.

for BSCS112

Create an array of five strings. Write a program that counts and display the number of vowel in the string that you entered, without regard the case. Class name is ArrayBSCS112xxx.

for BSIT112

Write a program that will accept 10 integer numbers store in an array. Compute and display the average. If the average is below 75 display the average, if the average is above 75 compute and display the square root of the average otherwise display the sum. Class name is ArrayBSIT112xxx.


Java Applet Problems

for DIT211

Create an applet with a Button and TextField. Input your name and display it in an 8pt font when button is cliked. Everytime the user clicks the Button, increase the font size for the displayed name by four points. Remove the Button when the font size exceeds 24 points. Class name is AppletDIT211xxx.

for DIT221

Create an applet with a Button labeled "Who's the greatest?" When the user clicks the button, display your name in a large font. Class name is AppletDIT221xxx.

for BSCS211

Create an applet that asks a user to enter a password into a TextField and then press the enter key. Compare the password to "Rosebud"; if they match, display "Access Granted"; if not, display "Access Denied". Class name is AppletBSCS221xxx.

for BSCOE411

Create a payroll applet named AppletBSCOE411xxx that allows the user to enter two double values - hours worked and hourly rate. When the user clicks a Button, net pay is calculated. Federal withholding tax is subtracted from gross pay (hours worked * hourly rate) based on the following table:

Income ($) ___________________ Withholding (%)
0 to 99.99 ______________________10
100.00 to 299.99 _________________15
300.00 to 599.99 _________________21
600.00 and up ___________________28