You are on page 1of 6

STRINGS

33. Design a class to input a string and print the letters on separate line.
34. Design a class to input a string and print the number of words in it.
35. Design a class to input a string and print the number of spaces in it.
36. Design a class to input a string and print the total number of vowels in it.
37. Design a class to input a string and print the total number individual
vowels in it.
38. Design a class to input a string and print each word in a separate line.
39. Design a class to input a string and change the case of each character of
the string and display the new string.
40. Design a class to input a string and replace every e with * and print the
new string.
41. Design a class to input a name and print only the initials .
42. Design a class to input a word and print whether it is a palindrome or not
43. Design a class to input a string and print the total number of
Upper case Letters
Lower case letters
Digits
Special Characters
44. Design a class to input a string and find the frequency of a word present
in the string.
If input: Tata steel is one of the steel manufacturing company of the
country.
Frequency of the word to be searched : the
The output : 2
45. Design a class to input a string and display all the vowels present in it.
46. Design a class to input a string and display the total number of
consonants in it.
47. Design a class to input a string and display the ASCII code of each
character in it.
48. Design a class to input a string in uppercase and print the string after
converting the string into lowercase except the first letter of each word .
If input : IF IT RAINS, YOU WILL NOT GO OUT AND PLAY
OUTPUT: If It Rains, You Will Not Go Out And Play

Classes and objects


Creating objects in main, entering information in the functions
49. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for
input , print and the main function to create objects
50.
Design a class employee having the following description.
Data members/ instance variables
Int pan
to store personal account number

String name
to store name
double taxincome
to store annual taxable income
double tax
to store tax that is calculated
Member functions:
input()
store the pan number , name taxable
income
calc()
Calculate tax for an employee
display()
output details of an employee
Write a program to compute the tax according to the given conditions
and display the output as per given format.
Total annual taxable income
Tax rate
Upto 1000000
From 1000001 to 150000
100000
From 150001 to 250000
exceeding
Above 2,50000
exceeding

No tax
10% of the income exceeding Rs.
Rs, 5000 +20% of the income
1,50000
Rs. 25000 +30% of the income

2,50000
51. Design class account with the following
Data members/instance variables
Customer number Customer name
Balance
Member functions:
Input() Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.
Creating objects in main , entering information in main using dot
operator
52. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for
input , print and the main function to create objects.
53. Design a employee having the following description.
Data members/ instance variables
Int pan
to store personal account number
String name
to store name
double taxincome
to store annual taxable income
double tax
to store tax that is calculated
Member functions:
input()
store the pan number , name taxable income
calc()
Calculate tax for an employee
display()
output details of an employee

Write a program to compute the tax according to the given conditions and
display the output as per given format.
Total annual taxable income
Tax rate
Upto 1000000
No tax
From 1000001 to 150000
10% of the income exceeding Rs.
100000
From 150001 to 250000
Rs, 5000 +20% of the income
exceeding
1,50000
Above 2,50000
Rs. 25000 +30% of the income
exceeding
2,50000
54. Design a class account with the following
Data members/instance variables
Customer number
Customer name
Balance
Member functions:
Input()
Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.

Creating object in main accepting data in main sending data to the


functions as arguments
55. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for
input , print and the main function to create objects.
56. Design a class employee having the following description.
Data members/ instance variables
Int pan
to store personal account number
String name
to store name
double taxincome
to store annual taxable income
double tax
to store tax that is calculated
Member functions:
input()
store the pan number , name taxable
income
calc()
Calculate tax for an employee
display()
output details of an employee

Write a program to compute the tax according to the given conditions


and display the
output as per given format.
Total annual taxable income
Tax rate
Upto 1000000
No tax
From 1000001 to 150000
10% of the income exceeding Rs.
100000
From 150001 to 250000
Rs, 5000 +20% of the income
exceeding
1,50000
Above 2,50000
Rs. 25000 +30% of the income
exceeding
2,50000
57. Design a class account with the following
Data members/instance variables
Customer number
Customer name
Balance
Member functions:
Input()
Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.
Creating one object using a loop
58. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for
input , print and the main function to create objects.
59.

Design a class employee having the following description.


Data members/ instance variables
Int pan
to store personal account number
String name
to store name
double taxincome
to store annual taxable income
double tax
to store tax that is calculated
Member functions:
input()
store the pan number , name taxable
income
calc()
Calculate tax for an employee
display()
output details of an employee
Write a program to compute the tax according to the given conditions
and display the output as per given format.
Total annual taxable income
Tax rate
Upto 1000000
No tax

From 1000001 to 150000


100000
From 150001 to 250000
exceeding
Above 2,50000
exceeding

10% of the income exceeding Rs.


Rs, 5000 +20% of the income
1,50000
Rs. 25000 +30% of the income
2,50000

60. Design a class account with the following


Data members/instance variables
Customer number
Customer name
Balance
Member functions:
Input()
Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.
Constructors ( Default)
61. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for
input , print and the main function to create objects
Parameterized Constructor
62. Design a class account with the following
Data members/instance variables
Customer number
Customer name
Balance
Member functions:
Input()
Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.
63. Design a class electricity bill with the following instance variables.
Customer number
Cust. address
Prev. month reading
Current month reading
Bill amt
Write a program to calculate and print the electricity bill for the customer.

Constuctor overloading
68. Write a program to declare a class student with integer data type for roll
no. string for name and float marks. The class must have functions for input,
print and the main function to create objects.
(2 objects)
69. Design a class account with the following
Data members/instance variables
Customer number
Customer name
Balance
Member functions:
Input()
Print()
Transact(char t, float amount)
Write a program in java to calculate the balance once the customer has
done a transaction.
70. Design a class electricity bill with the following instance variables.
Customer number
Cust address
Prev month reading
Current month reading
Bill amt
Write a program to calculate and print the electricity bill for the customer.
(3 objects)

You might also like