1. Write a program to create three single dimensional arrays integer empcode[], double sal[], double spl[] to store employee code, monthly salary and special allowances of 10 employees. Calculate the total monthly salary (sal =spl) and annual salary and total allowance.
2. Design a function void showtax(double tax[]).This function takes single subscripted variable tax[] as function argument with income tax amount of 8 salaried persons.Print average tax of all the persons along with maximum and minimum tax amount paid by the persons.
3. Write a program to initialize a single dimensional array num[] of 10 integer elements. Arrange the arry in descending order using bubble sort method.Print the array before and after sorting. Each array shoud be printed in single line with a suitable space between each element.
4. Write a program to initialize a single dimensional array number[] with 8 phone numbers of long integer tye. Arrange the array number[] in ascending order using any standard sorting method. Input a phone number 'phone'. Search 'phone' from the sorted list number[] using binary search method. Print the sorted array number[] in a single line with suitable space and also print message " Phone number not found in the list. Search unsuccessful."
5. Write a program to store average cycling speed of 10 cyclist falling in the following categories In two columns
Average speed (km/hr) Number of Cyclists
5 - 20 xx
21 - 50 xx
51 - 75 xx
76 - 89 xx
90 - 100 xx
6. Write a program to input a string. Convert the string into lowercase form and print the following pattern.
e.g :
Input : COBOL
Output :
cobol
cobo
cob
co
c
7. Write a program to input a string and display the number of uppercase characters, number of lowercase characters and number of digits present in the string. Make a suitable se of character functions.
8. Write a class arrange to input 5 car names in a array of string. Arrange car names in reverse alphabetical order using any sorting method.Print unsorted and sorted car names along with suitable headings.
9. Write a program to create a class arrangeletters and a method formalletters() with a string as parameter to input a word. Convert the word into uppercase form. Arrange each letter of the word in alphabetical order. Print the word before and after arranging letters in A - Z order.
e.g :
Input : LanGuAge
Output :
Original word = LanGuAge
Word in capitals = LANGUAGE
Word after sorting = AAEGGLNU
10. Write a program to input strings one by one till the user wants to continue . Find and print total number of strings which end with the string "ball".
Enter a word : football
Do you wish to continue? Press 1 to continue and 0 to exit
Enter a word : snowball
Total strings that ends with ball are/is : 2
11. Write a program to input a name. Convert each letter to its opposite case . Print the original and new name along with suitable messages.
Input : Sky LiNe
Output :
Original Name : SkY LiNe
New Name : sky lInE
12.Write a program to input a name and print the initials except the last word(surname). Each initial must be followed by symbol dot(.).
At the end , print total number of characters in the original name and in the initials except the blank spaces and other characters.
Input : Mahinder Singh Dhoni
Output : M.S Dhoni
Number of characters in the original name : xx
Number of characers in the initials : xx
13. Create a class interchange and a function change(interchange s) which receives two strings by reference. Interchange the strings stored in the object 's'.
14. Write another function to input two strings and interchange these strings by invoking function by reference. Print strings before and after interchange.
15. Create a function int countvowels(String str, char ch) to get a string in str and a vowel in ch. If the character stored in ch is a vowel, then convert into capital if small and return the occurance of capital vowel stored in ch from the string str if ch is present in str otherwise return 0. If character in ch is not a vowel, return -1.
16. Write a main function to input a string and a character. Print the occurance of ch in str by invoking the function countvowels().
17. Specify the class finder with the following overloaded functions :
i. int findmax(int n1, int n2) to decide and return largest from ni and n2. If both the numbers are same then return 0.
ii. int findmax(int n1,int n2,int n3) to decide and return largest from n1,n2 and n3. If all the numbers are same then return 0.
iii. Write a main function to input three numbers x,y,z(using scanner class method) and by invoking above functions print the largest from x,y and x,y,z. Use function overloading concept.
18. A number is said to be neon, if sum of all the digits of square of a number is equal to the number itself.
e.g :
Input :
9
Its square : 81 = 8+1 = 9(so it is a neon number)
25
Its square : 625=6+2+5=13o it is not a neon number)
19. Write a program to evaluate the function:
f(x) = (z2+2z)/(z+1) for all the values of z ranging from -4 to 4 by step 1.
i.e
x=-4,-3,-2,-1...........3,4
20. Write a program to input two numbers s1 and s2. Produce another number s3 which is the merging of numbers stored in s1 followed by s2. Print the values of s1, s2 and merged number s3.
e.g :
s1=256
s2=43
s3= 25643
2. Design a function void showtax(double tax[]).This function takes single subscripted variable tax[] as function argument with income tax amount of 8 salaried persons.Print average tax of all the persons along with maximum and minimum tax amount paid by the persons.
3. Write a program to initialize a single dimensional array num[] of 10 integer elements. Arrange the arry in descending order using bubble sort method.Print the array before and after sorting. Each array shoud be printed in single line with a suitable space between each element.
4. Write a program to initialize a single dimensional array number[] with 8 phone numbers of long integer tye. Arrange the array number[] in ascending order using any standard sorting method. Input a phone number 'phone'. Search 'phone' from the sorted list number[] using binary search method. Print the sorted array number[] in a single line with suitable space and also print message " Phone number not found in the list. Search unsuccessful."
5. Write a program to store average cycling speed of 10 cyclist falling in the following categories In two columns
Average speed (km/hr) Number of Cyclists
5 - 20 xx
21 - 50 xx
51 - 75 xx
76 - 89 xx
90 - 100 xx
6. Write a program to input a string. Convert the string into lowercase form and print the following pattern.
e.g :
Input : COBOL
Output :
cobol
cobo
cob
co
c
7. Write a program to input a string and display the number of uppercase characters, number of lowercase characters and number of digits present in the string. Make a suitable se of character functions.
8. Write a class arrange to input 5 car names in a array of string. Arrange car names in reverse alphabetical order using any sorting method.Print unsorted and sorted car names along with suitable headings.
9. Write a program to create a class arrangeletters and a method formalletters() with a string as parameter to input a word. Convert the word into uppercase form. Arrange each letter of the word in alphabetical order. Print the word before and after arranging letters in A - Z order.
e.g :
Input : LanGuAge
Output :
Original word = LanGuAge
Word in capitals = LANGUAGE
Word after sorting = AAEGGLNU
10. Write a program to input strings one by one till the user wants to continue . Find and print total number of strings which end with the string "ball".
Enter a word : football
Do you wish to continue? Press 1 to continue and 0 to exit
Enter a word : snowball
Total strings that ends with ball are/is : 2
11. Write a program to input a name. Convert each letter to its opposite case . Print the original and new name along with suitable messages.
Input : Sky LiNe
Output :
Original Name : SkY LiNe
New Name : sky lInE
12.Write a program to input a name and print the initials except the last word(surname). Each initial must be followed by symbol dot(.).
At the end , print total number of characters in the original name and in the initials except the blank spaces and other characters.
Input : Mahinder Singh Dhoni
Output : M.S Dhoni
Number of characters in the original name : xx
Number of characers in the initials : xx
13. Create a class interchange and a function change(interchange s) which receives two strings by reference. Interchange the strings stored in the object 's'.
14. Write another function to input two strings and interchange these strings by invoking function by reference. Print strings before and after interchange.
15. Create a function int countvowels(String str, char ch) to get a string in str and a vowel in ch. If the character stored in ch is a vowel, then convert into capital if small and return the occurance of capital vowel stored in ch from the string str if ch is present in str otherwise return 0. If character in ch is not a vowel, return -1.
16. Write a main function to input a string and a character. Print the occurance of ch in str by invoking the function countvowels().
17. Specify the class finder with the following overloaded functions :
i. int findmax(int n1, int n2) to decide and return largest from ni and n2. If both the numbers are same then return 0.
ii. int findmax(int n1,int n2,int n3) to decide and return largest from n1,n2 and n3. If all the numbers are same then return 0.
iii. Write a main function to input three numbers x,y,z(using scanner class method) and by invoking above functions print the largest from x,y and x,y,z. Use function overloading concept.
18. A number is said to be neon, if sum of all the digits of square of a number is equal to the number itself.
e.g :
Input :
9
Its square : 81 = 8+1 = 9(so it is a neon number)
25
Its square : 625=6+2+5=13o it is not a neon number)
19. Write a program to evaluate the function:
f(x) = (z2+2z)/(z+1) for all the values of z ranging from -4 to 4 by step 1.
i.e
x=-4,-3,-2,-1...........3,4
20. Write a program to input two numbers s1 and s2. Produce another number s3 which is the merging of numbers stored in s1 followed by s2. Print the values of s1, s2 and merged number s3.
e.g :
s1=256
s2=43
s3= 25643