Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1. The target interface is for a simple set of int: public interface Intset { boolean addToSet(int e); // adds e to the set
Question 1. The target interface is for a simple set of int: public interface Intset \{ boolean addToSet(int e); // adds e to the set if it is NoT already in the set. // returns true if e is added, false if e was already in the set. boolean deleteFromset(int e); // removes e from the set if it is in the set. // returns true if e was in the set, false if e is not in the set. boolean setContains(int e); // returns true if e is in the set, false if not. int sizeofset(); // the number of elements in the set. Complete the 4 methods of the following class adapter Here is a tester. public class IntSetTest \{ public static void main(String[] args) \{ IntSet set = new IntSetImpl (); System.out.println (set.addToset (1)); System.out.println (set.addToset (2)); System.out.println (set.addToset (2)); System.out.println (set.addToset (3)); System.out.println(set.sizeofset()); System.out.println (set. setContains (2)); System.out.println (set. deleteFromset (2)); System.out.println (set.setContains (2)); System.out.println (set. deleteFromset (2)); System.out.println(set.sizeofset())
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