Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program using Java Programming Language. All details are on the photos below. Object-oriented Programming Assignment #4 Deadline: Tuesday, Apr. 3 1. Program to

Write a program using Java Programming Language. All details are on the photos below.

image text in transcribed

image text in transcribed

Object-oriented Programming Assignment #4 Deadline: Tuesday, Apr. 3 1. Program to be implemented [a set of integers] A program that manages a set of integers 2. Overview (1) Implement the IntSet class set of integers s is a set whose elements are integers. For example. S = {1, 2, 7,-5}, s = 12, o, 4], m Design, write and test a program that deals with a set of integer elements Implement the methods and fields of the following IntSet class public class IntSet // ??? ?? ?? public void add (int element) // Add an element element. public void remove int element) /If the element is in the set, delete it. public void print 0 public int getSize 0 ) public int getElement (int index) / Obtain the index ith element. (Index starts from 0) public boolean isln (int element) I / Returns true if the element is in the set or return false if it is not. public void clear ) // Lists the elements of the set. // Returns the number of the element in the set // Delete all elements and make the set to be an empty set If you properly implement the class above, you can get the execution results of the test program belovw public class SetTester public static void main (Stringl args) IntSet s1new IntSet 0 s1.add (4) s1.add (2): s1.add (-3); System.out.printin ("sizes1.getSize0 / print: size 3 s1.print 0: // ?? : 4. 2.-3 System.out.println (s1.isln (2) ); I/ print: true s1.remove (-3), System.out.println (s1.isln (-3) ) // print: false for (int i = 0: i

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions