Question
1)Write a method that lets you insert a number anywhere in an array that is already full. For instance, if you have an array of
1)Write a method that lets you insert a number anywhere in an array that is already full. For instance, if you have an array of size 5: 3,6,1,2,0. You should be able to insert the number 9 in some desired/specified position. E.g 3,6,1, 9 ,2,0.
2)Ask the user for 5 friends first names. Store it in an array. Output the following:
The first letter of each friends name
The number of letters in each friends name
4. Create a shape interface that has the method for setColor. Have a rectangle and circle class inherit from it. They should have:
Regular constructor
Variables
Accessors and mutators
A method for area
The rectangle class should output Im in rectangle. and its color for the color
method and the circle class should output Im in circle and its color for the color method.
5. Create an array in main that uses polymorphism to instantiate your rectangle and circle classes.
6. Create a method that accepts a Shape object and outputs the color method. 7. Write a method that takes in a String array and sorts it.
8. Write a class called Person that has a name and ID# for variables. It should have a get and set for each variable, constructor, copy constructor, equals method and toString method. A person should also have a favorite number that is less than 100.
9. Write a class called Student that inherits from Person. It should have an array called CoursesTaken and it should redefine the ID# so that it can only be set to a 7 digit Student ID. Use the Person constructor and for this class. The favorite number of a Student can only be between 100 and 200.
10. Write a class called Worker that inherits from Person. It should have a variable for job and the requisite get/set methods. It should have override the equals method - two Workers will be
equal if they have the same job. The favorite number of a Worker can only be between 200 and 300
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started