You are on page 1of 2

JAVA Case Problem:

EASY

Create a JAVA program; sort.class that will sort entered whole numbers. The user may
input minimum of two (2) numbers and a maximum of ten (100) numbers.

SYNTAX: JAVA sort <SPACE> <first number> <SPACE> <second number> …


<100th number>

NOTE: Not following the syntax must produce an error message

SAMPLE OUTPUT:
C:\> java sort 5 4 2 1 3
You entered five numbers.
Sorted values:
1 2 3 4 5

AVERAGE

Body mass index (BMI) is an index of your weight - and classifies a person as
underweight, normal, overweight, or obese. The method of calculation is divide
weight in kilogram (Kg) by the square of the height in meters (m). Create a java
class (BMI.class) that will compute for the BMI of a person and categorize the
person on the following BMI ranges:

Category BMI range – kg/m2


Severely underweight less than 16.0
Underweight from 16.0 to 18.49
Normal from 18.5 to 24.9
Overweight from 25 to 29.9
Obese Class I from 30 to 34.9
Obese Class II from 35 to 40
Obese Class III over 40

SYNTAX: JAVA BMI <SPACE> <Weight (in Kg)> <SPACE> <Height (in m)>

NOTE: Not following the syntax must produce an error message


SAMPLE OUTPUT:
C:\> java BMI 70 1.71
Your Weight is 70 Kg
Your Height is 1.71 m
Your BMI is 23.9
You are NORMAL

DIFFICULT

Create a java class (Analyze.class) that will accept word or phrase. The program must
establish and display the following information:

 The entered word or phrase


 Number of word entered
 Number of characters each word
 Number of alphabetic character
 Number of vowels
 Number of consonants
 Number of numeric character
 Number of non-alphabetic/numeric characters.

SYNTAX: JAVA Analyze <SPACE> <Word or Phrase>

NOTE: Not following the syntax must produce an error message

SAMPLE OUTPUT:
C:\> java Analyze A whole new world!!!

The entered word or phrase is “A whole new world!!!”


Number of word(s) entered: 4
Number of character(s) each word:
Word 1: 1
Word 2: 5
Word 3: 3
Word 4: 8
Number of alphabetic character(s): 14
Number of vowel(s): 5
Number of consonant(s): 9
Number of numeric character(s): 0
Number of non-alphabetic/numeric character(s): 6

Prepared by:

EUGENE Q. CASTRO

You might also like