CSCI 135 Software Design and Analysis, C+
Lab 7
Solution
Saad Mneimneh
Hunter College of CUNY
Lab A: PiggyBank
Consider the following class:
class PiggyBank cfw_
int a[4];
/a[0] quarters
/a[1] dimes
/a[2] nickels
/a[3] pennies
bool breakable; /false by de
CSCI 135 Software Design and Analysis, C+
Lab 8
Solution
Saad Mneimneh
Hunter College of CUNY
Lab A: Skolem
An innite Skolem sequence a[0], a[1], a[2], . . . satises the following two conditions:
for every n N , there exist exactly two integers i and j s
CSCI 135 Software Design and Analysis, C+
Lab 9
Solution
Saad Mneimneh
Hunter College of CUNY
Lab A: Split
Write a function called split that has the following signature:
char * split(const char * s, char * t, bool b) cfw_
.
.
.
return t;
If b is true, i
CSCI 135 Software Design and Analysis, C+
Lab 8
Saad Mneimneh
Hunter College of CUNY
Lab A: Skolem
An innite Skolem sequence a[0], a[1], a[2], . . . satises the following two conditions:
for every n N , there exist exactly two integers i and j such that
CSCI 135 Software Design and Analysis, C+
Lab 9
Saad Mneimneh
Hunter College of CUNY
Lab A: Split
Write a function called split that has the following signature:
char * split(const char * s, char * t, bool b) cfw_
.
.
.
return t;
If b is true, it copies
CSCI 135 Software Design and Analysis, C+
Lab 6
Solution
Saad Mneimneh
Hunter College of CUNY
Lab A: Caesar cipher
Caesar cipher is a simple method of encryption. In a Caesar cipher each letter in a
word is replaced by a letter some specied number of posi
CSCI 135 Software Design and Analysis, C+
Lab 6
Solution
Saad Mneimneh
Hunter College of CUNY
Lab A: Caesar cipher
Caesar cipher is a simple method of encryption. In a Caesar cipher each letter in a
word is replaced by a letter some specied number of posi
CSCI 135 Software Design and Analysis, C+
Lab 3
Saad Mneimneh
Hunter College of CUNY
Practice loops and nested loops
Lab A: Lucas numbers
Lucas numbers are dened as the following sequence:
n
L(n)
0
2
1
1
2
3
3
4
4
7
5
11
6
18
.
.
Write a function called l
Csci 135 Exam 2 Review Sheet
Topics for Exam 2:
Chapter 6 Structures and Classes
Chapter 7 Constructors and Other Tools
Chapter 11.1 Separate Compilation
Chapter 12.1 File I / O
Some Sample Questions (these are just sample questions, DO NOT make any assum
Csci 135 Midterm exam 1 Review Sheet
Topics for Exam 1:
Chapter 1 Introduction to C+
Chapter 2 Flow of Control
Chapter 3 Function Basics
Chapter 4 Parameters and Overloading
Chapter 5 Arrays
Some Sample Questions (these are just some sample questions, DO
CSCI 135 Software Design and Analysis, C+
Homework 7
Due 4/11/2014
Saad Mneimneh
Hunter College of CUNY
Problem 1: Parlindromes
A palindrome is a string that reads the same forward and backward when spaces
are ignored. Here are example palindromes:
radar
CSCI 135 Software Design and Analysis, C+
Homework 5
Solution
Saad Mneimneh
Hunter College of CUNY
Problem 1: Uncertain Bool
Consider the following incomplete class declaration:
class UncertainBool cfw_
char b;
public:
.
.
.
;
The idea is to extend the bo
CSCI 135 Software Design and Analysis, C+
Homework 6
Solution
Saad Mneimneh
Hunter College of CUNY
Problem 1: A Point class
Consider the following class declaration for a point in 2D:
class Point cfw_
double x_coord;
double y_coord;
public:
Point(double x
CSCI 135 Software Design and Analysis, C+
Homework 6
Due 3/28/2014
Saad Mneimneh
Hunter College of CUNY
Problem 1: A Point class
Consider the following class declaration for a point in 2D:
class Point cfw_
double x_coord;
double y_coord;
public:
Point(dou
CSCI 135 Software Design and Analysis, C+
Homework 5
Due 3/21/2014
Saad Mneimneh
Hunter College of CUNY
Problem 1: Uncertain Bool
Consider the following incomplete class declaration:
class UncertainBool cfw_
char b;
public:
.
.
.
;
The idea is to extend t