1. Using if else statement write a program in Java to calculate the grade as per the given criteria:
% of marks Grade
75 - 100 passed with star
60 - 74 1st division
40 - 59 2nd division
Less than 40 Failed
2. Write a program to find the sum of the series:
3. Write a program to input a number n, output the results of the following evaluation based on the number entered by the user.
5. Write a program to input the number of days for issuing the library book. Calculate the charges according to the following criteria.
Days Charges
< 5 Re. 1.00
5 and <8 Rs. 2.00
8 and above Rs. 3.50
The program should work for n people.
6. Using an overloaded function add () , write a program to take an int array argument and find sum of all the elements. When a second argument ' O ' or ' E ' is passed with the int array, the program should return the sum of the odd numbers or even numbers respectively. If any other character is passed as the second argument, the function will return 0.
7. Write a program to accept two strings. Display the new string by taking each character of the first string from left to right and of the second string from right to left. The letters should be taken alternatively from each string. Assume that the length of both the strings are same.
eg :
First string : HISTORY
Second String : SCIENCE
New String : HEICSNTEOIRCYS
8. Write a program to enter a string , display the
Sample Input : He that is down needs fear no fall
Sample Output :
Number of two letter words = 3
Number of three letter words = 0
Number of four letter words = 4
9. Kesar Travels Pvt Ltd gives the following discount to its customers.
Ticket amount in Rs. Discount
Above 70000 18%
55001 to 70000 16%
35001 to 55000 12%
25001 to 35000 10%
Less than 25001 2%
10. Write a program to input the name and ticket amount for the customers and calculate the discount amount and the net amount to be paid. Display the output in the following format for each customer. The program should work as long as the user wishes to do so.
Sl. No Ticket chargers Discount Net amount
11. The annual examination results of 50 students in a class is tabulated
Roll no Subject A Subject B Subject C
Write a program to read the data into different arrays, calculate and display the following :
% of marks Grade
75 - 100 passed with star
60 - 74 1st division
40 - 59 2nd division
Less than 40 Failed
2. Write a program to find the sum of the series:
3. Write a program to input a number n, output the results of the following evaluation based on the number entered by the user.
- Absolute value of the number
- Square root of the number
- Power of the number
5. Write a program to input the number of days for issuing the library book. Calculate the charges according to the following criteria.
Days Charges
< 5 Re. 1.00
5 and <8 Rs. 2.00
8 and above Rs. 3.50
The program should work for n people.
6. Using an overloaded function add () , write a program to take an int array argument and find sum of all the elements. When a second argument ' O ' or ' E ' is passed with the int array, the program should return the sum of the odd numbers or even numbers respectively. If any other character is passed as the second argument, the function will return 0.
7. Write a program to accept two strings. Display the new string by taking each character of the first string from left to right and of the second string from right to left. The letters should be taken alternatively from each string. Assume that the length of both the strings are same.
eg :
First string : HISTORY
Second String : SCIENCE
New String : HEICSNTEOIRCYS
8. Write a program to enter a string , display the
- Total number of two letter words
- Total number of three letter words
- Total number of four letter words
Sample Input : He that is down needs fear no fall
Sample Output :
Number of two letter words = 3
Number of three letter words = 0
Number of four letter words = 4
9. Kesar Travels Pvt Ltd gives the following discount to its customers.
Ticket amount in Rs. Discount
Above 70000 18%
55001 to 70000 16%
35001 to 55000 12%
25001 to 35000 10%
Less than 25001 2%
10. Write a program to input the name and ticket amount for the customers and calculate the discount amount and the net amount to be paid. Display the output in the following format for each customer. The program should work as long as the user wishes to do so.
Sl. No Ticket chargers Discount Net amount
11. The annual examination results of 50 students in a class is tabulated
Roll no Subject A Subject B Subject C
Write a program to read the data into different arrays, calculate and display the following :
- average mark obtained by each student
- print the roll number of the students whose average marks is above 85.
- print the roll number of the students whose average marks is below 45.
No comments:
Post a Comment