0% found this document useful (0 votes)
25 views

Assignment Questions Due Date - 17-10-2021

The document outlines 6 assignment questions that are due on October 17, 2021 and must be submitted in handwritten form. The questions involve: 1. Writing a function to compare two Strings using Boolean comparisons and printing the results. 2. Creating a switch statement inside a for loop to try different cases with and without break statements. 3. Overloading the bark() method in a Dog class based on primitive data types to print different barks. 4. Creating a Tank class that verifies an empty death condition in finalize() and testing fill/empty scenarios. 5. Creating a Rodent inheritance hierarchy with methods in the base class overridden in derived classes like Mouse and Hamster. 6

Uploaded by

Majety S Lskshmi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Assignment Questions Due Date - 17-10-2021

The document outlines 6 assignment questions that are due on October 17, 2021 and must be submitted in handwritten form. The questions involve: 1. Writing a function to compare two Strings using Boolean comparisons and printing the results. 2. Creating a switch statement inside a for loop to try different cases with and without break statements. 3. Overloading the bark() method in a Dog class based on primitive data types to print different barks. 4. Creating a Tank class that verifies an empty death condition in finalize() and testing fill/empty scenarios. 5. Creating a Rodent inheritance hierarchy with methods in the base class overridden in derived classes like Mouse and Hamster. 6

Uploaded by

Majety S Lskshmi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT QUESTIONS

DUE DATE – 17-10-2021

NOTE: HANDWRITTEN DOCUMENT NEED TO BE SUBMITTED

1. Write a function that takes two String arguments, and uses all the Boolean
comparisons to compare the two Strings and print the results. For the == and
!=, also perform the equals( ) test. In main( ), call your function with some
different String objects.
2. Create a switch statement that prints a message for each case, and put the
switch inside a for loop that tries each case. Put a break after each case and
test it, then remove the breaks and see what happens.
3. Create a class called Dog with an overloaded bark( ) method. This method
should be overloaded based on various primitive data types, and print different
types of barking, howling, etc., depending on which overloaded version is
called. Write a main() that calls all the different versions.
4. Create a class called Tank that can be filled and emptied, and has a death
condition that it must be empty when the object is cleaned up. Write a finalize(
) that verifies this death condition. In main (), test the possible scenarios that
can occur when your
Tank is used.
5. Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In
the base class, provide methods that are common to all Rodents, and override
these in the derived classes to perform different behaviors depending on the
specific type of Rodent. Create an array of Rodent, fill it with different specific
types of Rodents, and call your base-class methods to see what happens.
6. Create three interfaces, each with two methods. Inherit a new interface from
the three, adding a new method. Create a class by implementing the new
interface and also inheriting from a concrete class. Now write four methods,
each of which takes one of the four interfaces as an argument. In main( ),
create an object of your class and pass it to each of the methods.

You might also like