1. A sales person is paid commission based on the sales as shown:
SALES COMMISSION
Under Rs. 500 2% of SALES
Rs. 500 and under Rs. 5000 5% of SALES
Rs. 5000 and over 8% of SALES
Write a class Commission which has an instance variable sales; an
appropriate constructor; and a method getCommission() which returns the commission amount. Write a Demo class in Java to test the Commission class by reading a sales amount from the user, using it to create a Commission object. Finally call the getCommission() method to get and print the commission amount. If the sales are negative, your Demo class should print the message “Invalid Input”. 2. Define a class called Complex with instance variables real, imag and instance methods setData(), display(), add(). Write a Java program to add two complex numbers. The prototype of add method is: public Complex add(Complex, Complex). Note: Complex number is of the form a+ib, where a is real part and b is imaginary part. 3. Write a Java program to declare a Class named as Student which contains roll number, name and course as instance variables and input_Student() and display_Student() as instance methods. A derived class Exam is created from the class Student . The derived class contains mark1, mark2, mark3 as instance variables representing the marks of three subjects and input_Marks() and display_Result() as instance methods. Create objects of the Exam class and display the result of 3 students. 4. A point in the x-y plane is represented by its x-coordinate and y- coordinate. Design a class PointType in Java that can store and process a point in the x-y plane. Perform operations on the point such as setting the coordinates of the point, printing the coordinates of the point, returning the x-coordinate, and returning the y-coordinate. Every circle has a center and a radius. Given the radius, we can determine the circle’s area and circumference. Given the center we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design a class CircleType that can store the radius and center of the circle. Because the center is a point in the x-y plane and you designed the class to capture the properties of a point from PointType class. You must derive the class CircleType from the class PointType. You should be able to perform the usual operations on a circle such as setting the radius, printing the radius, calculating and printing the area and circumference, and carrying out the usual operations on the center. 5. Let a class Person contains data members name and age. A constructor with two arguments is used to assign name and age. Person is of two types Student and Teacher. Class Student contains data members like course, Roll Number and Marks and method display() to display data related to student. Similarly class Teacher contains data members like subject_assigned , contact_hours and method display () to display data related to teacher. Implement this program using base class constructor in derived class. 6.Write a program in Java to count and display the number of objects created for a given class using constructor. 7. Write a program in Java to compute the sum of two time objects and also sum of three time time objects using method overloading and display the time in the form of hour, minute and seconds.