Assigemnt 2
Assigemnt 2
Write a JAVA application that can compute the letter grade of a student after accepting the
student’s mid and final mark. The program should only accept mid result [0-40] and final [0- 60].
If the data entered violates this rule, the program should display that the user should enter the
mark in the specified range. The program is also expected to run until the user refuses to
continue
2. Write Java Program that accepts radius of a circle from keyboard & compute the area of
the circle. Define a class called Circle, which is also Parameterized Constructor,
instance variable double radius and method double computeArea(). Use accessor
methods to set and get instance variables. Create an object and Invoke the method
computeArea () inside Java main method. [Hint: use this formula A=πr2]
3. Write JAVA Program that accepts any number, displays message Illegal Square Root if the
number is less than or equal to 0, Otherwise returns the Square root of the number.
4. Write JAVA program that Checks/Identifies whether a given number is Prime or Not. A prime
number is a positive integer which is only divisible by 1 and itself.
5. Develop Java Program that accepts integer input from keyboard and identifies whether it’s even
or odd. Define a class EvenOrOdd, which is also Parameterized Constructor, instance variable
int number, accessor methods and a method int isEven(). Create an object and call the method
isEven() inside Java main method.
6. Write a Simple java program to calculate the total mark out of 100% and give the grade. That will
accept student mark from the keyboard; i.e. Assignment 20%, test1 15%, test2 15% and final exam
50% and display as shown below. (3%)
Assign 20% Test1 15% Test2 15% Final 50% Total 100% Grade
19 12 13 43 87 A
1. Write java program to add and subtract two numbers based on the given information. (3%)
Class Name ArithmeticOperation one instance variable.
Class Name addition extend with ArithmeticOperation (it perform addition of one
instance variable with local variables and display the result).
Class name Subtraction extend with addition ((it perform subtraction of one instance
variable with local variables and display the result)
7.