New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Program Cis Majors 2

by: Aliyah Boyer

Program Cis Majors 2 CIS 3023

Aliyah Boyer
GPA 3.58


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Comm Sciences and Disorders

This 6 page Class Notes was uploaded by Aliyah Boyer on Friday September 18, 2015. The Class Notes belongs to CIS 3023 at University of Florida taught by Staff in Fall. Since its upload, it has received 5 views. For similar materials see /class/207037/cis-3023-university-of-florida in Comm Sciences and Disorders at University of Florida.

Similar to CIS 3023 at UF

Popular in Comm Sciences and Disorders


Reviews for Program Cis Majors 2


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/18/15
Problem 1 De ne assertion terms pre conditions post conditions and invariants giving examples of the difference between prepost conditions and invariants Solution Precondition a condition that should be true for a method to execute correctly Example int ndMinint inputArray return inputArray 0 For this method the precondition needs to be de ned as inputArray1ength gt1 and inputArray is sorted We can also de ne it mathematically as inputArraylength gt 1 AND V i st 0 lt i lt inputArray1ength inputArrayi lt inputArray i1 OR inputArraylength 1 Postcondition a condition that will be true after a method terminates Example void s0rtint inputArray The postcondition will be inputArray is sorted Similar to the precondition we can also de ne it mathematically Invariant class invariant 1 a condition that should always be true during the execution should be true for each object of the class Example Assume that we have a class Person and the class has an attribute of type int with name currentMoney We can de ne a class invariant the value of currentMoney should never be less than 0 In this class there may be different methods which may modify the value of this attribute However this invariant ensures that none of them assigns a value less than 0 Problem 3 List the problem solving techniques discussed in lecture and give an example problem where each would be useful Solution Write the problem in your own words Ex The problem can be given as a mathematical formula as Given int a st alength gt 0 nd i st Vj ai lt am We can easily rephrase this problem as Find the index of the minimum element in a given array a Try to reach the solution by solving a simpler problem Ex In order to nd the 3rd minimum number in an array we can start with creating a solution for nding the minimum element By using this solution the harder problem can be solved There are multiple ways of solving the problem once we know how to nd the minimum For instance we can copy the array into a temporary array Then we nd the minimum and change its value to MAXiVALUE of type we nd the minimum again and repeat the same procedure When we nd the minimum a third time this will be third minimum in the original array Try to reach the solution by solving a harder problem Ex In order to nd the second minimum number in an array you can rst sort the array and then get the element in the second position Start from the solution and go backwards Ex If the problem is to nd a solution to the sudoku game we can start with solving the problem by hand and trying to nd the steps to go from the initial state to the nal state See httpenwikipediaorgzwikiSudoku for a description of this game Use iterativerecursive re nements Ex these techniques can be used whenever we need to perform repetitive steps to reach the solution Sorting searching are simple examples for using this technique Problem 4 Analyze design implement a solution to randomly generating siX twodigit numbers Solve the problem by parsing the random number mathematically and as a String Also show how these solutions could be created iteratively and recursively Solution Iterative mathematical parsing public static int mathParseIterative double randomNumber Mathrand0m int numbers new int6 forint i0 ilt6 i randomNumber 100 int current int randomNumber ensure that the number is a 2digit number whilecurrent lt 10 randomNumber randomNumber current randomNumber 100 current int randomNumber numbers i current randomNumber randomNumber current return numbers Recursive String parsing public static int stringParseRecursive double randomNumber Mathrandom int numbers new int6 String s randomNumber quotquotsubstring2 return stringParseRecursives 0 numbers public static int stringParseRecursiveString s int index int numbers base case if index 6 return numbers if the string is consumed before generating all 2digit numbers create a new random number and continue recursive case 1 else ifslength lt 2 double randomNumber Mathrandom s randomNumber quotquotsubstring2 return stringParseRecursives 0 numbers recursive case 2 else int current IntegerparseIntssubstring02 s ssubstring2 if current lt 10 return stringParseRecursives index numbers else numbers index current return stringParseRecursives index numbers Problem 5 Determine whether and where two squares overlap on the Xycoordinate system Assume that both squares lie horizontally Solution This will be a practice of using problem solving techniques to solve a problem We can start by solving a simpler problem Then we can extend this solution to solve the harder problem The simpler problem will be to nd if any of the sides that are parallel to the XaXis overlap Let s de ne the points for both squares lel X2y2 x5y5 X6y6 x3y3 X4y4 X7y7 X8y8 We can rst check if any of the following are the same yl and y5 y1 and y7 y3 and y5 y3 and y7 If none of these are the same the sides parallel to the X aXis do not overlap For the ones that are the same we need to check if the X intervals overlap For instance if y1 and y5 are the same there is a possibility that the top sides of the squares will overlap In order to nd that we need to check if the intervals X1 X2 and X5 X6 overlap There are 4 cases in which these overlap Xl lt X5 lt X2 lt X6 overlap in the interval X5 X2 X1 lt X5 lt X6 lt X2 overlap in the interval X5 X6 X5 lt Xl lt X6 lt X2 overlap in the interval X1 X6 3959 X5 lt Xl lt X2 lt X6 overlap in the interval X1 X2 Once we have this solution we can use the same idea to nd if the sides that are parallel to the yaXis are overlapping By solving these two simpler problems we will eventually nd all the overlapping intervals for all sides


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.