devry comp122 full course latest 2015 [ all discussions all homework and all ilabs ]

Published on March 2017 | Categories: Business/Law | Downloads: 46 | Comments: 0 | Views: 499
Download PDF   Embed   Report

devry comp122 full course latest 2015 [ all discussions all homework and all ilabs ] Click Link Below To Buy: http://hwcampus.com/shop/comp122-full-course/ week 1 From Word Problem to Program Design (graded) This week we are looking at the process of analyzing a problem written in English, attempting to understand how we might build a program that solves the problem. Let's begin by looking at the analysis process and discussing what inputs are, what outputs are, and what processing is. What do we look for in a word problem to identify these components? What is an algorithm? diss 2 Using Variables and Arithmetic Expression (graded) Variables are used in a program for storing values. What sort of properties do all variables have in common? What type of arithmetic operations are supported in C++? What role does the data type of a variable have on the type of information the variable can contain and the type of operations that can be performed on the variable? What is operator precedence and how does it impact expression evaluation? week 2 Selecting Between Alternatives (graded) It is common to need to make choices between different alternatives when solving problems. Alternatives can take different forms. For instance,only do action X if condition 1 is true presents an alternative of either doing or not doing action X. A different form of alternative occurs in the case where we need to do action X if condition 2 is true, otherwise do action Y. Here we have a choice between 2 different actions, and we will always do X or Y depending on condition 2. This form can be extended to choosing between 3, 4, or any number of actions where one action is always selected. Lets discuss some real examples where making these types of choices are needed. Identify the alternative actions and the condition that controls the choice. diss 2 Input and Output Operations (graded) Many programs require the use of an input mechanism to get data into the program and an output mechanism to present results and guidance. When interacting with a user, a program must output instructions to the user and also output results that are formatte week 3 Recognizing Repetition (graded) This week's lecture discusses the different types of repetition situations and how they are controlled. Let's start out by discussing some simple example problems where you see the need for repetition. Is the repetition in your example count controlled, or would it be controlled by some sort of condition? Which type of loop would you choose for your example and why? Controlling When a Loop Completes (graded) Loops can be tricky and can cause errors in the program containing them. The trick is to get the loop to execute its body the correct number of times. Let's discuss how to figure out how many times a loop will execute its body. Give an example of a count controlled loop structure, explain how you determine the number of times it will execute its body. How will you determine the number of times a conditional controlled loop with a sample input set executes its body?\ week 4 Debugging and Testing a Program (graded) This week we are examining techniques for debugging and testing a program. Let's start off the week by discussing how to debug a program that compiles and links correctly, contains both selection and repetition statements, but does not generate correct output results. What techniques would you use to try to determine where the problems are in the program? Midterm Review (graded) The Midterm is this week. The Midterm covers all the material from the first 3 weeks of the course. Look back over the reading materials, homework, and labs from the first 3 weeks. The language summary documents can be a good source of review information about the specifics of C++. Use this thread to ask any questions that you have regarding anything you are uncertain about. If you don’t have a specific question, post some things you have observed about the programming process or about using C++. week 5 Prob. Decomp. and Recognizing Functions (graded) Most programming problems are quite large and difficult to fully understand. One approach to dealing with such a problem is to decompose the problem into smaller sub-problems (divide and conquer). Each sub-problem may then be further broken down into even smaller problems (stepwise refinement). Eventually, each remaining problem is small enough to develop a function for. Think about software systems you have used (i.e. word processor, web server, calculator, iPod, etc.) and identify some of the main functions that those systems would need. Passing Data Between Functions (graded) Functions would not be very useful if there were no way to pass information between them. Let's use this thread to discuss the mechanisms that functions use to communicate with each other. How does a caller provide values to a called function? How does a called function present a result to the caller? How do pass by value and pass by reference work? What determines when each technique should be used? week 6 Arrays and Repetition in Problem Solving (graded) There are many problems in programming that involve sets of information that can be managed within a program using arrays. Think about some different problems that could be solved using software and that include sets of information that could be represented using arrays. Give an example of an array declaration that could be used in a program to contain the data. Discuss how the data might need to be loaded into the array. diss 2 Using Loops to Process Array Data (graded) There are many situations where array data must be processed using loops. Give some examples of such situations. What sort of loop would you choose to use for your situation? Include some code examples illustrating how a program might process your array using a loop. week 7 Using C Style Strings (graded) Let's discuss how C-style strings are used in a program. How do you create a C-style string? Give examples. How do you input or output a C-style string? What kinds of tools are available to work with C-style strings? Show some examples of using those tools! Using the string Data Type (graded) You have been using the string type throughout this course. What new features have you discovered about the string type this week? Give some examples of how you might be able to use these new string capabilities in a program. homework COMP122 Week 1 Homework Part 1: Complete the following problems. 1. What is machine code? Why is it preferable to write programs in a high level language such as C++? 2. What does a compiler do? What kinds of errors are reported by a compiler? 3. What does the linker do? 4. What is an algorithm? 5. Bob enters a pizza shop and notices there are three different sizes of pizzas available. Sizes are given as the diameter of the pizza in inches. The cost of a pizza is based on the size. Bob would like to know which size of pizza has the lowest cost per square inch. a. Identify the inputs and outputs for this problem. b. Identify the processing needed to convert the inputs to the outputs. c. Design an algorithm in pseudocode to solve this problem. Make sure to include steps to get each input and generate each output. Part 2: Complete the following problems. 1. Given the following expressions, what value would they have in a C++ program? a. 13 / 4 b. 2 + 12 / 4 c. 21 % 5 d. 3 - 5 % 7 e. 17.0 / 4 f. 8 - 5 * 2.0 g. 14 + 5 % 2 - 3 h. 15.0 + 3.0 / 2.0 2. Given the following variable declarations: int num1 = 10, num2 = 20, newNum = 30; double x = 5.0, y = 8.0; Determine which of the following assignment statements are valid. For each invalid statement, explain why it is invalid. Assume that each statement immediately follows the above variable declarations. a. num1 = 15; b. num2 = num1 - 18; c. num1 = 5; num2 = 2 + 6; num1 = num2 / 3; d. num1 + num2 = newNum; e. x = 12 * num1 - 15.3; f. num1 * 2 = newNum; g. x / y = x * y; h. num2 = num1 % 2.0; i. newNum = static_cast (x) % 5; j. x = x + 5; k. newNum = num1 + static_cast (4.6 / 2); 3. For each of the following lines of variable declarations, identify it as valid or describe what makes the line invalid. Line 1: n = 12; Line 2: char letter = ; Line 3: int one = 5, two; Line 4: double x, y, z; 4. Write C++ statements that accomplish each of the following: a. Declare and initialize int variables x to 25 and y to 18. b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Add 5 to the int variable x which already exists. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value from an existing int variable firstNum into an existing int variable tempNum. f. Swap the contents of existing int variables x and y. (Declare any new variables you need.) g. Output the contents of existing double variables x and y, and also output the value of the expression x + 12 / y - 8. h. Copy the value of an existing double variable z into an existing int variable x. 5. Given the following variable declarations: int x = 2, y = 5, z = 6; What is the output from each of the following statements? a. cout > y; cin.ignore(50, '\n'); cin >> ch; b. cin >> x; cin.ignore(50, '\n'); cin >> y; cin.ignore(50, '\n'); cin.get(ch); 3. Suppose you are given the following variable declarations: int x, y; double z; char ch; Assume you have the following input statement: cin >> x >> y >> ch >> z; What values (if any) are stored in x, y, z, and ch if the input is: a. 35 62. 78 b. 86 32A 92.6 c. 12 .45A 32 4. Write a C++ statement that uses the manipulator 'setfill' to output a line containing 35 asterisk characters. 5. What is the output from the following statements? a. if ( 60

Comments

Content

devry comp122 full course latest 2015 [ all discussions all homework and all ilabs ] Click Link Below To Buy: http://hwcampus.com/shop/comp122-full-course/ week 1 From Word Problem to Program Design (graded) This week we are looking at the process of analyzing a problem written in English, attempting to understand how we might build a program that solves the problem. Let's begin by looking at the analysis process and discussing what inputs are, what outputs are, and what processing is. What do we look for in a word problem to identify these components? What is an algorithm? diss 2 Using Variables and Arithmetic Expression (graded) Variables are used in a program for storing values. What sort of properties do all variables have in common? What type of arithmetic operations are supported in C++? What role does the data type of a variable have on the type of information the variable can contain and the type of operations that can be performed on the variable? What is operator precedence and how does it impact expression evaluation? week 2 Selecting Between Alternatives (graded) It is common to need to make choices between different alternatives when solving problems. Alternatives can take different forms. For instance,only do action X if condition 1 is true presents an alternative of either doing or not doing action X. A different form of alternative occurs in the case where we need to do action X if condition 2 is true, otherwise do action Y. Here we have a choice between 2 different actions, and we will always do X or Y depending on condition 2. This form can be extended to choosing between 3, 4, or any number of actions where one action is always selected. Lets discuss some real examples where making these types of choices are needed. Identify the alternative actions and the condition that controls the choice. diss 2 Input and Output Operations (graded) Many programs require the use of an input mechanism to get data into the program and an output mechanism to present results and guidance. When interacting with a user, a program must output instructions to the user and also output results that are formatte week 3 Recognizing Repetition (graded) This week's lecture discusses the different types of repetition situations and how they are controlled. Let's start out by discussing some simple example problems where you see the need for repetition. Is the repetition in your example count controlled, or would it be controlled by some sort of condition? Which type of loop would you choose for your example and why? Controlling When a Loop Completes (graded) Loops can be tricky and can cause errors in the program containing them. The trick is to get the loop to execute its body the correct number of times. Let's discuss how to figure out how many times a loop will execute its body. Give an example of a count controlled loop structure, explain how you determine the number of times it will execute its body. How will you determine the number of times a conditional controlled loop with a sample input set executes its body?\ week 4 Debugging and Testing a Program (graded) This week we are examining techniques for debugging and testing a program. Let's start off the week by discussing how to debug a program that compiles and links correctly, contains both selection and repetition statements, but does not generate correct output results. What techniques would you use to try to determine where the problems are in the program? Midterm Review (graded) The Midterm is this week. The Midterm covers all the material from the first 3 weeks of the course. Look back over the reading materials, homework, and labs from the first 3 weeks. The language summary documents can be a good source of review information about the specifics of C++. Use this thread to ask any questions that you have regarding anything you are uncertain about. If you don’t have a specific question, post some things you have observed about the programming process or about using C++. week 5 Prob. Decomp. and Recognizing Functions (graded) Most programming problems are quite large and difficult to fully understand. One approach to dealing with such a problem is to decompose the problem into smaller sub-problems (divide and conquer). Each sub-problem may then be further broken down into even smaller problems (stepwise refinement). Eventually, each remaining problem is small enough to develop a function for. Think about software systems you have used (i.e. word processor, web server, calculator, iPod, etc.) and identify some of the main functions that those systems would need. Passing Data Between Functions (graded) Functions would not be very useful if there were no way to pass information between them. Let's use this thread to discuss the mechanisms that functions use to communicate with each other. How does a caller provide values to a called function? How does a called function present a result to the caller? How do pass by value and pass by reference work? What determines when each technique should be used? week 6 Arrays and Repetition in Problem Solving (graded) There are many problems in programming that involve sets of information that can be managed within a program using arrays. Think about some different problems that could be solved using software and that include sets of information that could be represented using arrays. Give an example of an array declaration that could be used in a program to contain the data. Discuss how the data might need to be loaded into the array. diss 2 Using Loops to Process Array Data (graded) There are many situations where array data must be processed using loops. Give some examples of such situations. What sort of loop would you choose to use for your situation? Include some code examples illustrating how a program might process your array using a loop. week 7 Using C Style Strings (graded) Let's discuss how C-style strings are used in a program. How do you create a C-style string? Give examples. How do you input or output a C-style string? What kinds of tools are available to work with C-style strings? Show some examples of using those tools! Using the string Data Type (graded) You have been using the string type throughout this course. What new features have you discovered about the string type this week? Give some examples of how you might be able to use these new string capabilities in a program. homework COMP122 Week 1 Homework Part 1: Complete the following problems. 1. What is machine code? Why is it preferable to write programs in a high level language such as C++? 2. What does a compiler do? What kinds of errors are reported by a compiler? 3. What does the linker do? 4. What is an algorithm? 5. Bob enters a pizza shop and notices there are three different sizes of pizzas available. Sizes are given as the diameter of the pizza in inches. The cost of a pizza is based on the size. Bob would like to know which size of pizza has the lowest cost per square inch. a. Identify the inputs and outputs for this problem. b. Identify the processing needed to convert the inputs to the outputs. c. Design an algorithm in pseudocode to solve this problem. Make sure to include steps to get each input and generate each output. Part 2: Complete the following problems. 1. Given the following expressions, what value would they have in a C++ program? a. 13 / 4 b. 2 + 12 / 4 c. 21 % 5 d. 3 - 5 % 7 e. 17.0 / 4 f. 8 - 5 * 2.0 g. 14 + 5 % 2 - 3 h. 15.0 + 3.0 / 2.0 2. Given the following variable declarations: int num1 = 10, num2 = 20, newNum = 30; double x = 5.0, y = 8.0; Determine which of the following assignment statements are valid. For each invalid statement, explain why it is invalid. Assume that each statement immediately follows the above variable declarations. a. num1 = 15; b. num2 = num1 - 18; c. num1 = 5; num2 = 2 + 6; num1 = num2 / 3; d. num1 + num2 = newNum; e. x = 12 * num1 - 15.3; f. num1 * 2 = newNum; g. x / y = x * y; h. num2 = num1 % 2.0; i. newNum = static_cast (x) % 5; j. x = x + 5; k. newNum = num1 + static_cast (4.6 / 2); 3. For each of the following lines of variable declarations, identify it as valid or describe what makes the line invalid. Line 1: n = 12; Line 2: char letter = ; Line 3: int one = 5, two; Line 4: double x, y, z; 4. Write C++ statements that accomplish each of the following: a. Declare and initialize int variables x to 25 and y to 18. b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Add 5 to the int variable x which already exists. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value from an existing int variable firstNum into an existing int variable tempNum. f. Swap the contents of existing int variables x and y. (Declare any new variables you need.) g. Output the contents of existing double variables x and y, and also output the value of the expression x + 12 / y - 8. h. Copy the value of an existing double variable z into an existing int variable x. 5. Given the following variable declarations: int x = 2, y = 5, z = 6; What is the output from each of the following statements? a. cout > y; cin.ignore(50, '\n'); cin >> ch; b. cin >> x; cin.ignore(50, '\n'); cin >> y; cin.ignore(50, '\n'); cin.get(ch); 3. Suppose you are given the following variable declarations: int x, y; double z; char ch; Assume you have the following input statement: cin >> x >> y >> ch >> z; What values (if any) are stored in x, y, z, and ch if the input is: a. 35 62. 78 b. 86 32A 92.6 c. 12 .45A 32 4. Write a C++ statement that uses the manipulator 'setfill' to output a line containing 35 asterisk characters. 5. What is the output from the following statements? a. if ( 60

Sponsor Documents

Recommended


View All
Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close