$29.99
Assignment 14
Note: Test class will have the main method.
1. Create a Java class Geometry, initialize methods for area and parameter calculation, define
variables for storing radius and edge. Create sub-classes Circle and Square. Show method
overriding through this example. Calculate area and parameters. Click here for method
overriding.
2. Add another sub-class rectangle(which inherits Geometry). Calculate area and parameter for
it. Comment if it is method overriding or overloading. Click here for method overloading
3. Create a class IndianUniversity define constructor in this class and initialize values of three
static variables i.e. NumStu=0, NumProg=0, NumUni=0. Create three sub-classes
Bennett(inherit IndianUniversity), SNU(inherit IndianUniversity), and IITB (inherit
IndianUniversity). Use constructor in all three sub classes to update the variables and a display
method to display these variables. Construct a new class(Test Class) create object of all three
classes. (number of students in Bennett, SNU, and IITB are 1200, 4000, 10000 respectively,
Each university is counted as 1 separate university, Bennett, SNU, and IITB respectively have
7, 4, and 15 programs). Show the outputs. (observation: check if values update and add for all
three cases;Note: Super() is called implicitly)
4. Create CSE as a subclass of Bennett (in the previous question) update NumStu=600,
NumProg=3. Override the display method of Bennett and show result.
5. Create a class Cars, construct two sub-classes SSC(inherits Cars) and CCX(inherits Cars). Define
a variable number of cars “NC” in class “Cars”. Update NC in SSC and CCX to 300 and 400
respectively. Construct a variable to display Total number of cars.
6. Construct a super class Calculator, create single integer parameter methods: Square and
Cube(both are present in Calculator Class). Create sub classes SS(inherit Calculator) and
SC(inherit Calculator). Construct methods : Square in SS and non-parametric method Cube in
SC.
1. Call “Square” and “Cube” from a new class Test Class.
2. Call “Square” method of class “calculator” from class SS.