Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 You have found the following legacy code in your code base public class Triple 7fields private String left; private String middle: private String

image text in transcribedimage text in transcribed

Part 1 You have found the following legacy code in your code base public class Triple 7fields private String left; private String middle: private String right; /constructor public Triple (String left, string middle, String right) this.left left: this.middle middle: this.rightright; 7getters and setters public string getLeft ) return left: ) public void setLeft (String left)this.left-left: public String getMiddle) return middle: public void setMiddle (String middle) this.middle middle: b public String getRight) return right: public void setRight (String right) this.right-right ) public string toString() { return "("+1eft+", "+middle+", "+right+")" As you can see, you can only have strings in a Triple. Your assignment is to 1. Convert this class to use generics so that you can store any types in a Triple. The types do not need to match for a Triple. For example, I should be able to store String, Double, Integer into a single Triple Write Junit tests to test this class using different data types. 2

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago

Question

=+derived from the assignment will balance the costs?

Answered: 1 week ago

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago