Computer Practical Work 22
Computer Practical Work 22
COMPUTER
PRACTICAL
WORK
Dimensional Array
(DDA) as m[5][6].
The Manager of the
shop wants to know
the total monthly sale
of each store and
each department at
any time. Write a
program to perform
the given task
4. Write a program to
input a sentence and
display the word of the
sentence that
contains maximum
number of vowels
5. Write a program to
accept a word and
convert it into lower
case, if it is in
upper case. Display the
new word by replacing
only the vowels with
the letter
following it.
6. Write a program to
input a sentence.
Count and display the
frequency of each
letter of the sentence in
alphabetical order
7. Write a program to
accept a string.
Convert the string into
upper case letters.
Count and output the
number of double
letter sequences that
exist in the string
4|Page
1.A tech number has even number of digits. If the number is split in two
equal halves, then the square of sum of these halves is equal to the number
itself. Write a program to generate and print all four digits tech numbers
import java.util.Scanner;
public class technum
{
public static void main(String args[])
{
int n, num, firstHalf, secondHalf, numberOfDigits=0,
squareOfTwoHalves;
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number: ");
//Store the input number into variable num
n = scan.nextInt();
//copying the value of n into a new variable num
num = n;
OUTPUT:-
import java.util.Scanner;
OUTPUT :-
9|Page
3.A Departmental Shop has 5 stores and 6 departments. The monthly sale
of the department is kept in the Double Dimensional Array (DDA) as m[5]
[6].The Manager of the shop wants to know the total monthly sale of each
store and each department at any time. Write a program to perform the
given task
import java.util.Scanner;
}
}
OUTPUT:-
11 | P a g e
4.Write a program to input a sentence and display the word of the sentence
that contains maximum number of vowels
import java.util.Scanner;
OUTPUT :-
import java.util.Scanner;
if (str.charAt(i) == 'a' ||
str.charAt(i) == 'e' ||
str.charAt(i) == 'i' ||
str.charAt(i) == 'o' ||
str.charAt(i) == 'u') {
}
else {
newStr = newStr + ch;
}
}
System.out.println(newStr);
}
}
15 | P a g e
OUTPUT :-
System.out.println("Character\tFrequency");
for (int i = 0; i < freqMap.length; i++) {
if (freqMap[i] > 0) {
System.out.println((char)(i + 65)
+ "\t\t" + freqMap[i]);
}
}
}
}
17 | P a g e
OUTPUT :-
7. Write a program to accept a string. Convert the string into upper case
letters. Count and output the number of double letter sequences that exist
in the sequences that exist in the string
import java.util.Scanner;
}
}
OUTPUT :-
19 | P a g e