Computer Programming C++ (wg) CCOs I. The student will analyze the different systems, and languages of the computer. (SM 1.4, 3.1, 3.4, 3.6) II. The student will write, compile, link and run a simple C++ program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) III. The student will use variables and constants within a program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) IV. The students will write a program that uses mathematical operations. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) V. The student will design a program that uses strings and uses the console for input/output. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) VI. The student will use selection structures within a program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) VII. The student will analyze program requirements and utilize appropriate loops to effectively handle data. (SM 1.4, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7) VIII. The student will write programs implementing and using their own functions (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) IX. The students will utilize pointers, enum and structures in their program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) X. The student will design a program that effectively manipulates data files. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) XI. The student will create and use classes. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) XII. The student will create a program using string functions and a string class. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) XIII. The student will utilize one and two-dimensional arrays. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) XIV. The student will select the appropriate sort type and implement a sort within a program. (SM 1.4,3.1, 3.2, 3.3, 3.5, 3.6) 1
I. The student will analyze the different systems, and languages of the computer. (SM 1.4, 3.1, 3.4, 3.6) Pre-Assessment: Convert numbers from base ten to the binary and hexadecimal number systems. A. Contents and Skills 1. Binary number system 2. Hexadecimal number system 3. Low level computer languages 4. High level computer languages 5. Operating systems 6. Programming process 1. Convert numbers among the different number systems. (MA 6) 2. List and describe operations managed by the operating system. (MA 1, 3) s 1. Given a combination of numbers in each base, the student should be able to convert the number to the remaining bases (hex, binary, or decimal). 2
II. The student will write, compile, link and run a simple C++ program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Describe the structure of a C++ program. 1. C++ program structure 2. Simple input/output 3. Compiling, linking and running a program 4. The correct use of comments in a C++ program. 1. Describe the structure of a C++ program. 2. Properly document a program by adding their name and program description as a comment at the top of the program. 3. Describe the roll of a header file in a C++ program. 1. Compile, link and run a program that outputs Hello World in a console application. 3
III. The student will use variables and constants within a program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Determine the number of bytes each data type occupies. 1. Integer variable type 2. Floating point variable type 3. Boolean variable type 4. Declaring and naming variables 5. Initializing variables 6. Constants 7. Casting 8. Promotion 1. Determine how many bytes each data type occupies. (MA 5) 2. Explain the difference between casting (by the user) and promotion (by the compiler). 3. Declare the constant PI to equal 3.14159. (MA 5) 4. Run a program where a variable gets too big for its type. (MA 5) 1. Create a program which only allows integer variables but outputs in decimal format when division is performed. 4
IV. The students will write a program that uses mathematical operations. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Given examples using compound operators give the long hand equivalent. 1. Arithmetic operators 2. Compound operators 3. Incrementing and decrementing operators 4. Order of operations 5. Errors (division by 0, etc.) 1. Use the modulus operator to determine if a number is even or odd. (MA 5) 2. Given examples using compound operators give the long hand equivalent. (MA 5) 3. Contrast the use of the incremental operators k++ and ++k, where k is an integer variable. 4. In a program, demonstrate where the use of the wrong data type results in an error. 1. Using incremental operators and the modulus operator, create a program where the outputs are different using the same numerical data. 5
V. The student will design a program that uses character arrays and uses the standard input/output streams. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program that uses a string function to assign a string to a character array and then outputs a string to the console. 1. Strings/Character arrays 2. Console input/output 3. Standard string functions from <string.h> 1. Declare and initialize a single character variable. 2. Declare and initialize a character array. 3. Use a string function to assign a string to a character array. 4. Use console input to assign a string to a character array. 5. Output a string to the console from a character array. 1. Write a program that asks the user for his/her name, address and phone number and stores each in separate character arrays. Using string functions, combine the information into a single character array and output this array to the screen. 6
VI. The student will use selection structures within a program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Use a relational operator to determine whether a number is positive or negative or zero. 1. Relational operators 2. Logical operators 3. If structure 4. If/Else structure 5. Switch structure 1. Demonstrate how short circuit evaluation can effect numerical results. 2. Use a relational operator to determine whether a number is positive or negative or zero. 3. Use a switch statement to output, in words, which number (from one to ten) was entered. 1. Use appropriate selection structure to assign a grade of A, B, C, D or F when given a numerical grade. 7
VII. The student will analyze program requirements and utilize appropriate loops to effectively handle data. (SM 1.4, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7) Pre-Assessment: Write a program to type how many letters were pressed before a z was entered. 1. For Loop 2. While Loop 3. Do While Loop 4. Nested Loop 5. Breaking out of a loop 6. Continue 1. Use a For Loop to output all even numbers from 1 to 100. 2. Write a program to type how many letters were pressed before a z was entered. 3. Generate the first 15 binary numbers using Nested Loops. 4. Create an infinite loop and use a break statement to exit from the loop. 1. Write a program to display all prime numbers between a range of numbers. 8
VIII. The student will write programs implementing and using their own functions. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program to pass a value to two different functions and perform a calculation on it in each separate function. One function should use value parameters while a second function must use reference parameters. 1. Structured programs 2. Scope of variables 3. Getting data to and from functions 4. Library functions 5. Overloaded functions 1. Take a program that you have already written and organize it into smaller functions. 2. Write a program to pass a value to three different functions and perform a calculation on it in each separate function. 3. Demonstrate the difference between a local and a global variable. 4. Write a program that passes a variable to a function by value. 5. Write a program to pass a value of a variable by reference. 6. Write a program to pass an array by using the technique of passing by reference. 7. Write programs that use math and string header files. 1. Write a program that uses functions. 9
IX. The students will utilize pointers, enum and structures in their program. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program that uses a single pointer to manipulate the values in two different variables. 1. Pointers and pointer declarations 2. Referencing (&) and dereferencing(*) operators 3. Pointers with character arrays 4. Subscript notation 5. Enum 6. Structures 1. Write a program that declares a pointer and manipulates values using it instead of the original variable. 2. Write a program using subscript notation to change the value of individual elements of a character array. 3. Write a statement that declares an enum type that uses at least three values. 4. Write the statements necessary to declare a structured variable that will form a new data type. 5. Write a program using structures to assign values to the new data types and print them out. 1. Write a program that reverses the elements of a character array using subscript notation. 10
X. The student will design a program that effectively manipulates data files. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program that prompts the user for two or more data file names and prints out their contents. 1. Sequential access and random access data files 2. Open and close data files 3. Read and write data files 4. Append to data files 5. Detect the end of the file 6. Prompt the user for file names 7. Open more than one data file at the same time 1. Compare and contrast random access and sequential access files. 2. Write the code necessary to open a data file. 3. Write the code to write to and read from a file. 4. Write the code to close a file. 5. Write a program that prints the contents of a file while checking for the end of the file. 6. Write a program that prompts the user for two or more data file names and prints out their contents. 1. Write a program that prompts the user for the name of a text file and reports the number of characters in the text file and the number of end of line characters in the file. 11
XI. The student will create and use classes. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Read the code of a program that uses classes and describe the execution of the program. A. Contents and Skills 1. Class methods 2. Class properties 3. Private data 4. Public Data 5. Encapsulation and inheritance 1. Read the code of a program that uses classes and understand the execution of the program. 2. Modify an existing class. 3. Modify a class by adding member functions. 4. Create a.cpp and a.h. 5. Break a class into a header file and a source file. 1. Create a class of your own design that has at least two private variables and two member functions. 12
XII. The student will create a program using string functions and a string class. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program to convert strings to integers, floating point, and long. A. Contents and Skills 1. Various apstring functions and their use 2. Basic apstring class 3. Advance object-oriented concepts used in the string class 1. Write a program that will find the length of a string. 2. Write a program to concatenate strings. 3. Write a program that uses string classes. 4. Write a program to convert strings to integers, floating point, and long. 1. Write a program to determine if an entered string is a palindrome. 13
XIII. The student will utilize one and two-dimensional arrays. (SM 1.4, 3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program that generates a set of numbers and assigns them to an array. 1. One - dimensional arrays 2. Two - dimensional arrays 1. Write a program to identify the highest and lowest numbers in an array. 2. Write a statement that declares an array with ten elements. 3. Write a program that uses two-dimensional arrays. 1. Write a program that implements two mathematical matrices as twodimensional arrays and adds the two matrices. 14
XIV. The student will select the appropriate sort type and implement a sort within a program. (SM 1.4,3.1, 3.2, 3.3, 3.5, 3.6) Pre-Assessment: Write a program that uses a sort. 1. Basics of sorting 2. Selection sort 3. Insertion sort 4. Bubble sort 5. Merge sort 1. Write a program that uses a sort. 1. Write a program that sorts data in ascending or descending order. 15
Scoring Guide (wg) Function 4 3 2 1 Program works as Program works but not as Program has runtime bugs. Program doesn t work. assigned. assigned or can be crashed by user. Prompts Prompts are clear concise. Prompts are abbreviated. Prompts are incorrect. Prompts are without text. Formatting Output is appropriately formatted with respect to the situation. Program exhibits some formatting. Program has minimal formatting. Output is not formatted. Documentation All documentation. Most documentation. Some documentation. No documentation. Proper use of functions and pass values Values are passed correctly from function to function by argument. Pass a value but get wrong answer. Declaration of a global variable not value passing. No values passed. 03/10/15