Computer Science 340
Programming Languages

Fall 2019, Siena College

Problem Set 6: Datatypes, Expressions and Assignments, Control Structures
Due: 11:59 PM, Sunday, November 10, 2019

This problem set consists of several questions, some of which require you to complete relatively short programming tasks. You may work alone or in a group of size 2 or 3 on this assignment.

Getting Set Up

You will receive an email with the link to follow to set up your GitHub repository for this problem set (ps6-yourgitname). If you are working on this problem set with a partner, one member of the group should follow the link to set up the repository on GitHub. Your problem set partner will receive a subsequent email with a link to follow that will grant them the rights to clone the repository and commit and push changes to the origin on GitHub.

By 4:00 PM, Friday, November 1, 2019, all repositories must be created and if working in a group, the partner who did not create the repository must have write access to the repository. Your name(s) must be in the repository by this deadline as well.

Questions and Programs

Question 1: Sebesta Chapter 7 Problem Set Exercise 20, p. 325. (3 points)

Question 2: Answer Sebesta Chapter 7 Problem Set Exercise 13, p. 325, then do Sebesta Chapter 7 Programming Exercise 1, p. 328. (8 points)

Question 3: Sebesta Chapter 7 Programming Exercise 9, p. 328. Include your program in your submission and the actual timing results. (6 points)

Question 4: (10 points) Write a program in some language that supports both 32- and 64-bit floating point types (e.g., C, C++, Java) that demonstrates the importance of evaulation order. One way to do this is as follows. Add together 10 copies each of the numbers 0.1, 0.01, 0.001, ..., 0.000000001. Do this both in order from largest to smallest and from smallest to largest. Also do it with 32-bit values (floats) and 64-bit values (doubles). Print your results with 15 digits after the decimal point and thoroughly explain what you observe.

Question 5: Sebesta Chapter 8 Problem Set Question 4, p. 361. (3 points)

Question 6: Sebesta Chapter 8 Problem Set Question 5, p. 361. (3 points)

Question 7: Sebesta Chapter 8 Problem Set Question 9, p. 361. (3 points)

Question 8: Sebesta Chapter 8 Problem Set Question 10, p. 361. (3 points)

Question 9: Do Sebesta Chapter 8 Programming Exercise 1, p. 362. You are encouraged to work with classmates beyond your group to come up with the code samples, but the discussion of readability and writability should be your own. (8 points)

Question 10: Do Sebesta Chapter 8 Programming Exercise 3, p. 362. Use each language's switch statement or an equivalent, not just a bunch of ifs and elses. Again, you are encouraged to work with classmates beyond your group to come up with the code samples, but the discussion of the merits should be your own. (7 points)

Question 11: Do Sebesta Chapter 8 Programming Exercise 5, p. 362. (6 points)

Question 12: Do Sebesta Chapter 8 Programming Exercise 6, p. 362. (5 points)

Submission

Commit and push!

Grading

This assignment will be graded out of 65 points.

Feature

Value Score
Question 1: PS Exercise 7.20 3
Question 2: PS Exercise 7.13 response 3
Question 2: Programming Exercise 7.1 programs 5
Question 3: Programming Exercise 7.9 program 3
Question 4: Program 5
Question 4: Results and analysis 5
Question 5: PS Exercise 8.4 3
Question 6: PS Exercise 8.5 3
Question 7: PS Exercise 8.9 3
Question 8: PS Exercise 8.10 3
Question 9: Programming Exercise 8.1 programs 4
Question 9: Programming Exercise 8.1 discussion 4
Question 10: Programming Exercise 8.3 programs 3
Question 10: Programming Exercise 8.3 discussion 4
Question 11: Programming Exercise 8.5 program 3
Question 11: Programming Exercise 8.5 discussion 3
Question 12: Programming Exercise 6 programs 3
Question 12: Programming Exercise 6 explanation 2
Total 65