Write a generic class called myfour

Assignment Help Business Management
Reference no: EM131195227

Note: Please do provide the code in Java

Write a generic class called "MyFour". It should use a type parameter of "T". It should have four fields, item1, item2, item3, item4, all of type T. Its constructor receives values for setting all four items. It should have a method "allEqual" that returns true if all four items are equal according to their "equals" method. It should have a method called "shiftLeft" that shifts all items up one position, and puts the first item's value into the last item.

For example, if list has 1, 2, 3, 4, then after shiftLeft, it is 2, 3, 4, 1.

It should have a "toString" method that returns a String of the items in this format: (item1, item2, item3, item4).

Finally, add a "main" method. First it should create a MyFour object of type String, passing it four identical strings. Print the object, then call and print the results of "allEqual". Next, create an object of four different Integers. Again print the object and print the results of "allEqual". After that, shift the items left using your method, and print them again.

Reference no: EM131195227

Questions Cloud

Number of sales offices in several states : The firm has a number of sales offices in several states, Attributes of sales   include , Office Number(identifier) and Location.Each Sales Office is assigned one or more employees. Attributes of employee include Employee ID(identifier) and Employ..
Draw the feasible solution for the lp problem : Draw the feasible solution for the LP problem. The Janie Gioffre Drapery Company makes three types of draperies at two different locations.
The spiff or the fact that these are closeout models : For each of the following situations, put yourself in the shoes of the salesperson. Indication what you believe the appropriate action would be in each situation and why. In an electronic store, salespeople are offered an extra $50 for each sale of H..
Estimate the time to collect recycables in green roll-out : Estimate that it takes 30 seconds to empty the contents of each green container into the truck and a set-out amount of 12 kgs.
Write a generic class called myfour : Write a generic class called "MyFour". It should use a type parameter of "T". It should have four fields, item1, item2, item3, item4, all of type T. Its constructor receives values for setting all four items. It should have a method "allE..
Which school of jurisprudence bases its principles : Which school of jurisprudence bases its principles, for solving legal disputes, on broad notions of fairness, and subjective decision making by judges?
Review careers landing page and examine content : Select a current company from this Web site to serve as the focal point of research and analysis during this course. You must notify the instructor of your choice of company by Tuesday of Week 2. You may NOT change the company selected during the ..
Calculate the overall energy content of the waste : Using the energy content (wet basis) of the waste components given in the Table P2-17, calculate the overall energy content of the waste having the composition shown. This calculation can be simplified by assuming 100 lb of waste
Strategic analysis model : Use the company of your choice - this company could be your own business, a friend's business, a client's business, the business/organization for which you work, or a public firm.

Reviews

Write a Review

Business Management Questions & Answers

  Management assignment-managers decision making

If you were the CEO of one of the world's most "hated" companies, what would be your top three priorities in addressing your reputation issues?

  Ethical scales in situation

In the situation described above, is the firm acting unethically in any way and should motive or conduct carry greater weight on the ethical scales in this situation?

  Monthly status reportsread the required article perfecting

monthly status reportsread the required article perfecting project management by drew robb. list three ways a project

  Merging customer databases

Merging Customer Databases - Transition to a single system from multiple systems from different companies

  How the changing global environment presents challenges

Read and reflect on the case study about Sony on page 119 of the course textbook. Consider the CEO's reorganization. What environmental constructs were involved?

  Show the corporate goals and objective

Show the corporate goals and objective and how does corporate social responsibility benefit stockholders, employees and customers

  Create a presentation for training on effective leadership

Create a 27-30-slide PowerPoint presentation for training others on effective leadership and building trust in virtual teams, based on a provided scenario.

  Select a country except one in north america

Select a country except one in North America. This country will be the foundation for this assignment and subsequent individual assignments.

  Improve performance throughout a multinational corporation

Summarize what you believe are the two (2) most critical elements to consider when on-boarding in the global environment.

  Probability of p being defective

A manufacturer produces items that have a probability of p being defective. These items are formed into batches of 150. Past experience indicates that some batches are of good quality

  Brief description of non-profit or government organization

Post a brief description of the non-profit or government organization that you selected. Explain issues that are not addressed in the organization's current strategic plan

  Questionthis case study is on the basis of a work scenario

questionthis case study is on the basis of a work scenario. for this situation pretend that you are an hr

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd