Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer all the questions 2. Design two programs named BaseClass and SubClass. In BaseClass, define a variable xVar (type: char, value: 65), and a

Please answer all the questions image text in transcribed
image text in transcribed
2. Design two programs named BaseClass and SubClass. In BaseClass, define a variable xVar (type: char, value: 65), and a method myPrint to print xVar. SubClass is a subclass of BaseClass. In SubClass, define a variable yVar (type: int, value: 16) and another variable strVar (type: String, value: "java program!"). There is also a method myPrint to print the value of yVar and strVar in SubClass, as well as an additional method printAll, in which invoking myPrint method both from the base class and sub class. Write a test program. In the main method, declare an instance of SubClass named bObj. Then use the object to call method printAll to output all the properties of that object. 3. Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, unior, or senio. Define the status as a constant. An employee has an office, salary, and date hired. Define a class named MyDate that contains the fields year, month, and day. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the person's name Draw the UML diagram for the classes. Implement the classes. Write a test program that creates a Person, Student, Employee, Faculty, and Staff, and invokes their toString) methods. e th od 4. Write a Java application which contains a class called ArrayMethods. The ArrayMethods class contains methods with the following headers: public int duplicate(char[ arrayl, char[] array2) This method copies each character from array array1 into the same location of array array2. array2 must have already been instantiated and be of the same or greater length as arrayl. The method returns the number of elements copied. public boolean same (char[ array1, char] array2) This method examines arrays array1 and array2 character by character and retums false if a character in array1 is different than a character at the corresponding location in array2 or if the arrays are of different length. The method returns true if every character of array1 is the same as the corresponding character in array2. These are the only methods in the ArrayMethods clas:s

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

7. What strategies can people apply to resist popular culture?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago