Cs Functional Prog. Writeup

In: Computers and Technology

Submitted By acclaimx
Words 1404
Pages 6
Data Structures and Functional Programming CS 3110, Fall 2013 Version: 6

Problem Set 4 Due at 11:59 PM, Thursday, October 17 Last Modified: October 22, 2013

Instructions
Compile Errors
All code you submit must compile. Programs that do not compile will be heavily penalized. If your submission does not compile, we will notify you immediately. You will have 48 hours after the submission date to supply us with a patch. If you do not submit a patch, or if your patched code does not compile, you will receive an automatic zero.

Naming
We will be using an automatic grading script, so it is crucial that you name your functions and order their arguments according to the problem set instructions, and that you place the functions in the correct files. Incorrectly named functions are treated as compile errors and you will have to submit a patch.

Code Style
Finally, please pay attention to style. Refer to the CS 3110 style guide and lecture notes. Ugly code that is functionally correct may still lose points. Take the extra time to think out the problems and find the most elegant solutions before coding them up. Good programming style is important for all assignments throughout the semester.

Late Assignments
Please carefully review the course website’s policy on late assignments, as all assignments handed in after the deadline will be considered late. Verify on CMS that you have submitted the correct version, before the deadline. Submitting the incorrect version before the deadline and realizing that you have done so after the deadline will be counted as a late submission.

Getting started
This problem set is long; we recommend you start thinking about all of the parts early. Parts two and three depend on part one, but you only need to implement one of the modules (Floats) in part one to get started on them. The things you have to do are indicated by “Exercise”…...

Similar Documents

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- Java – CS520 Week 5 CS520 Week 5 Assignment Create a package named cs520.hw5. Using this package, create the following classes. Create a class named Student as follows. The class keeps track of the student’s homework grades. This is a modification of HW4 using arrays. The instance (or member) private variables – name (String), homeworks (an integer array). A static public integer variable, NUM_HOMEWORKS, initialized to 6. A single constructor with name as its argument. Also, allocate the space for the homeworks array to hold NUM_HOMEWORKS values The public get and set methods for the name instance variable. A void setHomeworkGrade method which takes two arguments – a zero based index of the homework and the corresponding homework grade. In the body of the method, store the homework grade into the corresponding array location. A public computeAverage method which takes no arguments and returns a double showing the average homework grade for this student. You should use a for loop to add the homework grades and then compute the average. This code should be independent of the length of the homework array. Override the toString method to return the string representation of this object in the format “The ’s average grade...

Words: 603 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- Java-CS520-HW 3-part1 Create a package named cs520.hw3.part1. Using this package, create a class named BullsEye extending the JFrame class with the following specifications: a. Declare the integer type instance variables centerX, centerY, outermostRadius, and ringWidth. The first two values represent the center of the bulls eye, the third value represents the radius of the outermost circle, and the last value is the width of each ring. b. In the constructor, specify the appropriate window title using your lastName and assign the above instance variables with the values 150, 150, 100, and 12, respectively. Note that the ring width is different in this homework. c. In the paint method, a. Declare a variable named currentRadius and assign the outermostRadius to it. b. Declare an integer counter variable and initialize it with the value 0. c. Using a while construct, repeat the following steps as long as the currentRadius variable has a positive value. • If the counter is even valued, set the current color to blue. Otherwise, set the current color to pink. • Fill a circle using the specified center coordinates and the current radius value. • Decrement the current radius by the ring width. • Increment the counter. In the main method, create the......

Words: 256 - Pages: 2

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS520 Week 4 Assignment Part 1 (40 Points) – Strings Create a package named cs520.hw4.part1. Using this package, create the class StringTest and implement the specified functionality in its main method. a. Ask the user, through a single input dialog, for the user’s first name, last name, and age in the format FirstName,LastName,Age b. Trim the user’s input, in case spaces were entered at the beginning or at the end. c. Display the trimmed data to the console. Do the following operations using this trimmed string. d. Find the index of the first comma in the input using the indexOf method. Using this value, extract the first name part of the input using the substring method. e. Display the position of the first comma, the first name, and the length of the first name to the console. f. Find the index of the second comma in the input using the indexOf method. Using this value, extract the last name part of the input using the substring method. g. Display the position of the second comma, the last name, and the length of the last name to the console. h. Extract the age using the substring method. Convert the value to an integer. Display the age in 10 years from now. Now, examine the code for all possible exceptions that could......

Words: 633 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- cs 520 week 4 part 1 Create a package named cs520.hw4.part1. Using this package, create the class StringTest and implement the specified functionality in its main method. a. Ask the user, through a single input dialog, for the user’s first name, last name, and age in the format FirstName,LastName,Age b. Trim the user’s input, in case spaces were entered at the beginning or at the end. c. Display the trimmed data to the console. Do the following operations using this trimmed string. d. Find the index of the first comma in the input using the indexOf method. Using this value, extract the first name part of the input using the substring method. e. Display the position of the first comma, the first name, and the length of the first name to the console. f. Find the index of the second comma in the input using the indexOf method. Using this value, extract the last name part of the input using the substring method. g. Display the position of the second comma, the last name, and the length of the last name to the console. h. Extract the age using the substring method. Convert the value to an integer. Display the age in 10 years from now. Now, examine the code for all possible exceptions that could occur. Using a single try-catch......

Words: 630 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- Create a package named cs520.hw3.part1. Using this package, create a class named BullsEye extending the JFrame class with the following specifications: a. Declare the integer type instance variables centerX, centerY, outermostRadius, and ringWidth. The first two values represent the center of the bulls eye, the third value represents the radius of the outermost circle, and the last value is the width of each ring. b. In the constructor, specify the appropriate window title using your lastName and assign the above instance variables with the values 150, 150, 100, and 12, respectively. Note that the ring width is different in this homework. c. In the paint method, a. Declare a variable named currentRadius and assign the outermostRadius to it. b. Declare an integer counter variable and initialize it with the value 0. c. Using a while construct, repeat the following steps as long as the currentRadius variable has a positive value. • If the counter is even valued, set the current color to blue. Otherwise, set the current color to pink. • Fill a circle using the specified center coordinates and the current radius value. • Decrement the current radius by the ring width. • Increment the counter. In the main method, create the application object, set its size to 300......

Words: 251 - Pages: 2

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- cs 520 week 5 Create a package named cs520.hw5. Using this package, create the following classes. Create a class named Student as follows. The class keeps track of the student’s homework grades. This is a modification of HW4 using arrays. The instance (or member) private variables – name (String), homeworks (an integer array). A static public integer variable, NUM_HOMEWORKS, initialized to 6. A single constructor with name as its argument. Also, allocate the space for the homeworks array to hold NUM_HOMEWORKS values The public get and set methods for the name instance variable. A void setHomeworkGrade method which takes two arguments – a zero based index of the homework and the corresponding homework grade. In the body of the method, store the homework grade into the corresponding array location. A public computeAverage method which takes no arguments and returns a double showing the average homework grade for this student. You should use a for loop to add the homework grades and then compute the average. This code should be independent of the length of the homework array. Override the toString method to return the string representation of this object in the format “The ’s average grade is ”. Create a Test......

Words: 599 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- cs 520 week 5 Create a package named cs520.hw5. Using this package, create the following classes. Create a class named Student as follows. The class keeps track of the student’s homework grades. This is a modification of HW4 using arrays. The instance (or member) private variables – name (String), homeworks (an integer array). A static public integer variable, NUM_HOMEWORKS, initialized to 6. A single constructor with name as its argument. Also, allocate the space for the homeworks array to hold NUM_HOMEWORKS values The public get and set methods for the name instance variable. A void setHomeworkGrade method which takes two arguments – a zero based index of the homework and the corresponding homework grade. In the body of the method, store the homework grade into the corresponding array location. A public computeAverage method which takes no arguments and returns a double showing the average homework grade for this student. You should use a for loop to add the homework grades and then compute the average. This code should be independent of the length of the homework array. Override the toString method to return the string representation of this object in the format “The ’s average grade is ”. Create a Test......

Words: 599 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 3 assignment pART 2 Create a new Java Project in Eclipse named HW3 and complete the following two parts.Part 2 – InheritanceCreate a package named hw3.part2. Using this package, create the following classes and implement the specified functionality. Create a class named Employee as follows. The instance (or member) private variables – name (String) and wageRate (integer). The wageRate denotes the weekly wages (@40 hours/week) for this employee. A single constructor with two arguments, the name and the wage rate. Set the instance variables with the specified argument values. The public set and get methods for the two instance variables. A public computePayStub method which takes a double argument, named hours, and returns a double showing the weekly wages for this employee. The employee is only paid for a maximum of 40 hours for the week based on the weekly wageRate. If this employee worked less than 40 hours, the wages are prorated accordingly. Override the toString method to return the string representation of this object in the format “Employee:@$/week”. No instance variables are allowed in the Consultant class. A single constructor with two arguments, the name and the......

Words: 455 - Pages: 2

Cs 520,Cs/520,Cs520

...CS 520 Week 3 assignment pART 1 Create a new Java Project in Eclipse named HW3 and complete the following two parts.Part 1 – Repetition ConstructCreate a Swing GUI application, which displays the following graphics by modifying the last week’s assignment, and using the loop constructs (for or while) as described below.Create a package named hw3.part1. Using this package, create a class named RedAndBlackSteps extending the JFrame class with the following specifications: Declare the integer type instance variables startX, startY, brickWidth, brickHeight, and brickSpace. The first two values represent the top-left coordinates of the red brick in the first row. The next two values are the width and height of each brick. The last value represents the space between each brick along any direction. Declare another integer instance variable, numberOfRows, representing the number of rows desired for the pattern. In the constructor, specify the appropriate window title using your lastName and assign the instance variables in step a) with the values 400, 50, 50, 30, and 2, respectively. In the constructor, initialize the numberOfRows with the value 5. In the paint method, declare two local variables named currentX and currentY. Assign the startX and startY variables to these local variables, respectively. Using nested loops, draw the pattern for the desired numberOfRows. Note that the pattern should work for other values as......

Words: 281 - Pages: 2

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 2 assignment pART 3 You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss approaches to the homework assignment with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program! Create a new Java Project in Eclipse named HW2_lastName. Create a package named cs520.hw2 and complete the following three parts by writing the appropriate classes under this package. Part 3 (40 Points) Create a......

Words: 643 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS520 Week 2 Assignment General Rules for Homework Assignments You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss approaches to the homework assignment with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program! Create a new Java Project in Eclipse named HW2_lastName. Create a package named cs520.hw2 and complete the following three parts by......

Words: 373 - Pages: 2

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 2 assignment You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss approaches to the homework assignment with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program! Create a new Java Project in Eclipse named HW2_lastName. Create a package named cs520.hw2 and complete the following three parts by writing the appropriate classes under this package. Part 1 (30 Points) Suppose a......

Words: 474 - Pages: 2

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 1 assignment You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss approaches to the homework assignment with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program. Our bank ATM stores the money in the following denominations – hundreds, fifties, twenties, tens, fives, twos, and ones. The bankhas the following policy. When a customer withdraws money, the ATM dispenses the amount using the maximum bills from the......

Words: 568 - Pages: 3

Cs 520,Cs/520,Cs520

...HELPIDO.COM FOLLOW THIS LINK TO GET THE TUTORIAL ---------------------------------------------------- http://helpido.com/category/cs-520/ ---------------------------------------------------- CS 520 Week 6 assignment You are strongly encouraged to add comments throughout the program. Doing so will help your facilitator to understand your programming logic and grade you more accurately. You must work on your assignments individually. You are not allowed to copy the answers from the others. However, you are encouraged to discuss the approaches to the homework assignments with your section mates and the facilitator in your section via the discussion board. Each assignment has a strict deadline. However, you are still allowed to submit your assignment within 2 days after the deadline with a penalty. 15% of the credit will be deducted unless you made previous arrangements with your facilitator and professor. Assignments submitted 2 days after the deadline will not be graded. The assignment solution will be available 48 hours after the assignment deadline. When the term lastName is referenced in an assignment, please replace it with your last name. You are strongly encouraged to add comments into your program! Create a new Java Project in Eclipse named HW6_lastName and complete the following requirements based on the Threads. Several threads will share a single object and contribute their individual result to the shared object.......

Words: 598 - Pages: 3

Functional

...Functional Health Pattern Assessment (FHP) | Pattern of Health Perception and Health Management: * How does the person describe current health? * What does the person do to maintain health? * What does person know about links between lifestyle and health? * How big a problem is financing health care for this person? * Can this person report his/her medications and the reason for taking them? * If this person has allergies, what does he/she do to prevent/manage them? * What does the person know about medical problems in his/her family? * Have there been any important illnesses/injuries in this person’s life? | Nutritional-Metabolic Pattern: * Is this person well-nourished? * How does this person’s food intake compare with recommended food intake? * Does this person have any disease that affects nutritional/metabolic function? | Pattern of Elimination: * Are the person’s excretory functions within normal range? * Does the person have any disease of the digestive system, urinary system, or skin? | Pattern of Activity and Exercise: * How does this person describe his/her weekly pattern of: Activity/Leisure?--Exercise/Recreation? * Does this person have any disease that affects his/her: Cardio/Respiratory System?--Musculoskeletal System? | Cognitive/Perceptual Pattern: * Does this person have any sensory deficits? If yes, are they corrected? * Can this person express himself/herself clearly and logically? * What is......

Words: 455 - Pages: 2

Sandy Baron | Mentalista / The Mentalist ... | Atomic Blonde2017115 min +15