September 7th, 2016
How to turn in assignments:
1. Program name: initials followed by an underscore and assignment name. Example: GE_Snowman.java
2. Header information: Description of assignment, author and date
3. If the program generates output from test run, the output should be included in the program as comments
4. Upload the files with extension “.java”
5. Copy and paste your code onto the reply.
Classwork:
1. If you have not done so, visit edmodo.com
Create and account or join with the code given in the home page.
Note: Please use your full name as your screen name.
2. Read thoroughly the assignment below. Find a partner and discuss it.
3. Use paper and pencil/pen to “show” the IntegerSet and its functionality.
Homework due tomorrow:
1. Send me an email(graciela_elia@princetonk12.org) with your parents email address: the email subject should have student name and class period and class name:
Ex:
Subject: 3rd period – Intro to Comp -Your name
2. Discuss the class policy with your parents.
3. Visit edmodo.com and reply to the “Introduce yourself” post.
Java Language and OOD Review Assignment
Due date: September 14th, 2016
- It will be graded based on design and correct implementation of the specifications.
- It is due on September 14th, 2016.
- Attach pseudocode for the union and intersection methods
- Attach a flowchart for the union and intersection methods. Here are some basic flowhcart symbols you need to know:
- Implement the driver/test class.
Create class IntegerSet. Each object of the class can hold integers in the range 0 through 100. A set is represented internally as an array of booleans. Array element a[i] is true if integer i is in the set. Array element a[j] is false if integer j is not in the set. The no-argument constructor initializes a set to the so-called “empty set” (i.e., a set whose array representation contains all false values).
Provide the following methods:
1. Method unionOfIntegerSets creates a third IntegerSet which is the set-theoretic union of two existing sets (i.e., an element of the third set’s array is set to true if that element is true in either or both of the existing sets; otherwise, the element of the third set is set to false).
2. Method intersectionOfIntegerSets creates a third IntegerSet which is the set-theoretic intersection of two existing sets i.e., an element of the third set’s array is set to false if that element is false in either or both of the existing sets; otherwise, the element of the thirds set is set to true).
3. Method insertElement inserts a new integer k into a set (by setting a[k] to true).
4. Method deleteElement deletes integer m (by setting a[m] to false).
5. Method setPrint prints a set as a list of numbers separated by spaces. Print only those elements that are present in the set. Print “- – -” (3 dashes) for an empty set.
6. Method isEqualTo determines if two sets are equal.
Write a program to test your IntegerSet class. Instantiate several IntegerSet objects. Include proof that all your methods work properly.
NOTE: Use your IntegerSet drawing and flowchart to work on the implementation.
I WILL COLLECT ALL YOUR PAPERS. MAKE SURE YOUR NAME AND PERIOD ARE ON IT.