Premium Essay

Chapter 3 Programming Logic and Design Tony Gadis Partial

In: Computers and Technology

Submitted By JakeAustin12
Words 645
Pages 3
Assignment #3 – Chapter #3
Wharton Class Due: Tuesday, September 16th @ 8:45am
FBTC Class Due: Wednesday, September 17th @ 10:15am

M/C Questions 1 – 15, pp. 113-4 (30 pts. total – 2 pts. ea.) 1. c
2. a
3. d
4. b
5. c
6.a
7.a
8. b
9. c
10. a
11. b
12. c
13. a
14. d
15. b

T/F Questions 1 – 12, p.115 (12 pts. total – 1 pt. ea.) 1. f
2. t
3. t
4. f
5. t
6. f
7. f
8. t
9. t
10.f
11. t
12. f Algorithm Workbench #1 - #7, pp.115-6 – Write pseudocode (not Java) (21 pts. total)
1. Module Main()
Declare userNum as Integer
Display "Enter a number" input userNum call TimesTen(userNum)
Display userNum
End

Function TimesTen(integer userNum) userNum = (userNum * 10) return userNum
End Function

Algorithm Workbench #1 - #7, pp. 115-6 (continued) – Write pseudocode (not Java)

2. def main(): showvalue() def showvalue(): print '12'

main()

3.
The value stored in ‘a’ will be: 3
The value stored in ‘b’ will be: 2
The value stored in ‘c’ will be: 1
4. Declare Integer age
Declare Real income
Declare String name

Call Module1 (agem Real_Income, Name)

5.

6.

7.

Debugging Exercises, p.117 (3 pts. Ea. / 12 pts. Total )

1.

2.

3.

4.

Programming Exercises, (#1 - p.117) (10 points total)
#1. Kilometer Converter
Design a modular program that asks the user to enter a distance in kilometers, and the converts that distance to miles. The conversion formula is as follows:
Miles = Kilometers * 0.6214
Additional Instructions:
1. Design using pseudocode.
2. Use the following module names: getKilometers – read kilometers from user keyboard input and store in ‘kilometers’ variable showMiles – accepts ‘kilometers’ variable as input argument and displays the equivalent value in miles
Module main () Declare…...

Similar Documents

Free Essay

Programming Logic and Design, 6th Edition

...Programming Logic and Design, 6th Edition Chapter 2 Exercises 1. Explain why each of the following names does or does not seem like a good variable name to you. Answer: Answers will vary. A possible solution: a. | c | – | Valid, but probably too short to be descriptive | b. | cost | – | Good | c. | costAmount | – | Good, but redundant | d. | cost amount | – | Invalid, spaces aren’t allowed | e. | cstofdngbsns | – | Valid, but difficult to read | f. | costOfDoingBusinessThisFiscalYear | – | Valid, but long and awkward | g. | costYear2012 | – | Good | h. | 2012YearCost | – | Invalid, cannot start with a digit | 17 2. If myAge and yourRate are numeric variables, and departmentName is a string variable, which of the following statements are valid assignments? If a statement is not valid, explain why not. Answer: a. | myAge = 23 | – | Valid | b. | myAge = yourRate | – | Valid | c. | myAge = departmentName | – | Invalid, cannot assign string to numeric | d. | myAge = “departmentName” | – | Invalid, cannot assign string to numeric | e. | 42 = myAge | – | Invalid, cannot assign a value to a literal constant | f. | yourRate = 3.5 | – | Valid | g. | yourRate = myAge | – | Valid | h. | yourRate = departmentName | – | Invalid, cannot assign string to numeric | i. | 6.91 = yourRate | – | Invalid, cannot assign a value to a......

Words: 1719 - Pages: 7

Premium Essay

Programming Logic and Design 6th Ed

...Programming Logic and Design, 6th Edition Chapter 5 Exercises 1. What is output by each of the pseudocode segments in Figure 5-22? Answer: a. 5, 22, 5 b. 4, 6, 7 c. 5, 6 d. Goodbye Goodbye Goodbye Goodbye Goodbye Goodbye Goodbye Goodbye Goodbye e. Hello Hello Hello f. Adios Adios Adios Adios Adios Adios Adios Adios 2. Design the logic for a program that outputs every number from 1 through 10. Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num number housekeeping() number = 1 while number 99999 output “Please enter a valid zip code” input custZip endwhile return validateCustAge() while custAge < 10 OR custAge > 110 output “Please enter a valid customer age” input custAge endwhile return validateNumItems() Declarations num attempts = 0 num LIMIT = 2 validNumItems = 1 while (numItems < 1 OR numItems > 12) AND attempts < LIMIT output “Please reenter the number of items” input numItems attempts = attempts + 1 endwhile if attempts = 2 AND numItems < 0 then output “An invalid number of items was entered” output “This order will not be counted” validNumItems = 0 endif return housekeeping() output ZIP_PROMPT input custZip return detailLoop() output AGE_PROMPT input custAge output ITEM_PROMPT input......

Words: 1493 - Pages: 6

Premium Essay

Logic and Design

...Programming Logic and Design, 6th Edition Chapter 6 Exercises 1. a. Design the logic for a program that allows a user to enter 10 numbers, then displays them in the reverse order of their entry. Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num index num SIZE = 10 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0 getReady() while index < SIZE getNumbers() endwhile finishUp() stop getReady() index = 0 return getNumbers() output “Enter a number for position ”, index input numbers[index] index = index + 1 return finishUp() output “The numbers in reverse order are: ” while index > 0 index = index – 1 output numbers[index] endwhile return b. Modify the reverse-display program so that the user can enter up to 10 numbers until a sentinel value is entered. Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num index num SIZE = 10 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0 string CONTINUE = “Y” string moreNumbers = CONTINUE getReady() while index < SIZE AND moreNumbers equal to CONTINUE getNumbers() endwhile finishUp() stop getReady() index = 0 output “Do you want to enter a number? (Y/N)” input moreNumbers return getNumbers() output “Enter a number for position ”, index input numbers[index] index =......

Words: 4366 - Pages: 18

Premium Essay

Logic Design

...Assignment 2: Logical Design, Part 1 Due Week 2 and worth 50 points You have been hired by ACME Global Consulting to procure requirements for a large database. In developing database management systems, E-R models are used to graphically depict complex relationships between entities. In this assignment, you are to convince a set of clients of the benefits of using an E-R model in developing a database. Write a two to three (2-3) page paper in which you: 1. List the advantages of a relational model specific to ACME Global Consulting. 2. Summarize in your own words the purpose of an E-R model specific to ACME Global Consulting. 3. List and describe essential components of the model such as entities, attributes, keys, relationships, roles, and dependencies specific to ACME Global Consulting. 4. Describe the need for the enhanced E-R model and how we can create sophisticated models to help us in complex environments. 5. Outline and describe the advantage of using the relational model. 6. Create an E-R diagram using graphical depicting software that could theoretically be used in a restaurant application. Note: The graphically depicted solution is not included in the required page length. Acceptable software used to depict the solution includes any drawing tool, such as Microsoft Visio, Microsoft Paint, open source alternatives or similar drawing tools. You are free to formulate constraints, entities, attributes, etc. Potential entities may include but are not limited to......

Words: 449 - Pages: 2

Premium Essay

Programming Logic

...use it as a default structure in creating two deviating figures from having Boolean system incorporated as such “If” and “then” structures that will correlate into having a rhetorical questions answerable by “yes” and “no” structure. As the plain yes or no and true or false play into scene the chart and figure moves apart as desired answers have certain consequences built. The yes or no and true or false structure will outline two deviating answers to each other that separates each other apart. This create the uniqueness in the flow diagram. As this goes, we create a flow diagram, in such we are able to see where the program will lead us. The advantage of using Pseudocode is that it does not use any syntax or structures within its programming realm. It is easy to understand because it is readable in plain text with the written flow of what needed to be applied in the program that is later applied in the flow diagram. In so speaking, any layman with no experience in computer programs would be able to read the Pseudocode system....

Words: 412 - Pages: 2

Free Essay

Algorithms and Logic for Computer Programming

...Personal Learning Management University of Phoenix Algorithms and Logic for Computer Programming PRG 211 Professor Sam March 07, 2013 Personal Learning Management Being able to develop a management tool that would allow a user or student to review course material would be very beneficial. With a course such as programming that has so much information, it is important to be able to recall information in order to properly understand how programming works. I for example, do not have any prior knowledge of so I would have to continuously refresh the information that I have learn in the reading as well as in the class room environment. I will be discussing some topics that are important to the development of such a program. In order to properly develop an application, we must first address and analyze the problem that has caused this need. In this situation, we want to design an application that will allow students to be able to review reading assignments as well as task or anything that would be beneficial to retain. Some subjects are a harder to remember than others such as programming. Modular programming would be the best fit because we would want everyone to read the material in the same order. We would set up the program so everyone’s view is the same. If we allow people to “jump around” in the programming, some learning material is going to be skipped over and that would defeat the purpose of the development of this application. Submodules would be......

Words: 480 - Pages: 2

Free Essay

Programming Logic Gate Functions in Plcs

...This sample chapter is for review purposes only. Copyright © The Goodheart-Willcox Co., Inc. All rights reserved. 138 Programmable Logic Controllers: Hardware and Programming Chapter 7 7.1 Introduction The majority of PLC manufacturers use the ladder logic diagram programming language to program their programmable logic controllers (PLCs). Some manufacturers prefer using logic gate circuits or Boolean expressions to program their PLCs. Therefore, it is beneficial to know how to convert one type of PLC programming language to the other. In this chapter, you will learn how to create logic gate circuits from ladder logic diagrams and vice versa. You will review the functions associated with the combinational logic gates. These gates are the NOT, AND, OR, NAND, NOR, XOR, and XNOR gates. You will learn how to create PLC ladder logic diagrams that emulate the functions of these gates. Programming Logic Gate Functions in PLCs Chapter Outline 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 Introduction Combinational and Sequential Logic Gate Circuits Boolean Expressions, Truth Tables, and Logic Gate Circuits NOT Gates or Inverters AND Gates OR Gates NAND Gates NOR Gates XOR (Exclusive OR) Gates XNOR (Exclusive NOR) Gates Simplifying Boolean Expressions Creating PLC Ladder Logic Diagrams from Logic Gate Circuits Creating PLC Ladder Logic Diagrams from Boolean Expressions Creating Logic Gate Circuits from PLC Ladder Logic Diagrams Technical......

Words: 9164 - Pages: 37

Free Essay

Digital Logic Design

...12/11/2013 Digital Logic Design CSE-241 Unit 21 4-bit Asynchronous Counter: 2 Muhammad Usman Arif 12/11/2013 1 12/11/2013 MODULUS OF A COUNTER:  The modulus of a counter is the number of unique states that the counter will sequence through. The maximum possible number of states (maximum modulus) of a counter is 2n. Where n is the number of flip-flops in the counter. TRUNCATED SEQUENCES:  Counters can also be designed that have a number of states in their sequence that is less than the maximum of 2n.the resulting sequence is called a truncated sequence. Muhammad Usman Arif 3 12/11/2013 ASYNCHRONOUS DECADE COUNTER:  To obtain a truncated sequence, it is necessary to force the counter to recycle before going through all of its possible states. For example, the BCD decade counter must recycle back to the 0000 state after the 1001 state. One way to make the counter recycle after the count of nine (1001) is to decode count ten (1010) with a NAND gate and connect the output the clear (CLR) input. 4 Muhammad Usman Arif 12/11/2013 2 12/11/2013 ASYNCHRONOUS DECADE COUNTER: 5 Muhammad Usman Arif 12/11/2013 PARTIAL DECODING:  Notice in the figure that only Q1 and Q3 are connected to the NAND gate inputs. This arrangement is an example of partial decoding; in which the two unique states (Q1 = 1 and Q3 =1 ) are sufficient to decode the count of ten because none of the other states (zero through nine)......

Words: 492 - Pages: 2

Free Essay

Chapter 1-3 Computer Structure and Logic Review

...Chapter 1 review questions 1. Which of the following is an example of a PC? The 8088 processor marked the start of the home and office based PC’s given that it had a 1mb address limit making a more efficient machine. 2. Who is credited with the patent of the first computer? John V. Atanasoff was the first person accredited for the invention of the computer due to his use of modern digital switching techniques. 3. In the Von Neumann architecture, what two make up the CPU? In Von Neumann’s model of the CPU there are three components, only two are listed in this review and they are the control unit and the arithmetic unit. 4. What technology alleviates the problem of the “Von Neumann bottleneck”? in this chapter they explain the issue of bottlenecking like a highway, where the information sent and received traveled through a narrow highway on the original architecture. The solution to the problem was creating what is now referred to as Cache memory. 5. Which of the following are groups within the Von Neumann architecture? There are four groups to the basic architecture Working Storage, Permanent Storage, Output and Input devices. 6. What are the three main connections in a transistor. Transistors are made using the same architecture as a vacuum tube just in a much smaller and safer manner, these connections are called the “Gate” the “Drain” and the “conductor”. 7. MOSSFET is the most common type of what electronic component? MOSSFET (standing for......

Words: 2681 - Pages: 11

Free Essay

Logic and Design

...компонентов * ------------------------------------------------- 3) комплекс программных и аппаратных средств. 4.2. Основная функция ЭВМ: * ------------------------------------------------- 1) общение человека и машины * ------------------------------------------------- 2) разработка задач * 3) принцип программного управления. 4.3. Персональный компьютер состоит из: * ------------------------------------------------- 1) системного блока * ------------------------------------------------- 2) монитора * ------------------------------------------------- 3) клавиатуры * ------------------------------------------------- 4) дополнительных устройств * 5) комплекса мультимедиа. 4.4. Системный блок включает в себя: * ------------------------------------------------- 1) системную плату * ------------------------------------------------- 2) блок питания * ------------------------------------------------- 3) модулятор-демодулятор * ------------------------------------------------- 4) накопители на дисках * ------------------------------------------------- 5) платы расширений * 6) средства связи и коммуникаций. 4.5. Микропроцессор предназначен для: * ------------------------------------------------- 1) управления работой компьютера и обработки данных * ------------------------------------------------- 2) ввода информации в ЭВМ и вывода ее на принтер * 3) обработки текстовых данных. 4.6. Разрядность......

Words: 3164 - Pages: 13

Free Essay

Logic and Design

...Austin Jones Ch. 2 Multiple Choice 1. A 2. A 3. D 4. B 5. A 6. C 7. C 8. A 9. B 10. D 11. B 12. A 13. C 14. A 15. D 16. B 17. B 18. C 19. D 20. A True or False 1. FALSE 2. TRUE 3. FALSE 4. TRUE 5. FALSE 6. TRUE 7. TRUE 8. TRUE 9. FALSE 10. FALSE Short Answer 1. Figure out what the user wants and how it can be mathematically solved. 2. pseudocode is "fake" code, or code without syntax 3. Sequence, Decision and Iteration 4. The program is easy for the user to navigate through and use. 5. the name and what kind of data type it will hold 6. nothing. Algorithim Workbench 1. Display “Height” Input Height Display “here is the height that you entered:” , height 2. Display “Favorite color” Input favorite color Display “Here is your favorite color you entered:” , color 3. b = a + 2 a = b * 4 b = a/3.14 a = b - 8 4. a. Set result = x + y b. Set result = z * 2 c. Set result = y / x d. Set result = y – z result = x++ - y; Answer -4 result = 4 – 8 = -4 result = ++w + y; Answer w = w + 1 = 5 + 1 = 6 result = 6 + 8 = 14 5. Declare Real price= 0.00 Display "the original price." Input item original price Display "price" 6. Declare Real price= 0.00 Display "the original price." Input item original price Display "price" 7. count := 27 8....

Words: 253 - Pages: 2

Free Essay

Research Assignment 3 Intro to Programming Logic and Design

...Research Assignment 3: Exploring Reverse Engineering • What is reverse engineering? Reverse engineering is the general process of analyzing a technology specifically to ascertain how it was designed or how it operates. This kind of inquiry engages individuals in a constructive learning process about the operation of systems and products. Reverse engineering as a method is not confined to any particular purpose, but is often an important part of the scientific method and technological development. The process of taking something apart and revealing the way in which it works is often an effective way to learn how to build a technology or make improvements to it. When reverse engineering software, researchers are able to examine the strength of systems and identify their weaknesses in terms of performance, security, and interoperability. The reverse engineering process allows researchers to understand both how a program works and also what aspects of the program contribute to its not working. • What are the advantages and disadvantages of using reverse engineering to discover the logics of a software program? Reverse engineering in software is reversing a program's machine code back into it's original source code. The advantages to using this technique is that one can repair certain bugs, see how a program operates, and improve the operation              of the program. The disadvantage is that certain other bugs may be introduced              during this process. ...

Words: 301 - Pages: 2

Premium Essay

Exponent Calculator Programming Logic and Design

...Purpose: Calculate the result of a number raised to the power of another number input by the user using iterative logic without overflow of 32-bit integers##   //Program start// START //declare variables // declare unsigned int base, exp, answer, errorInput, errorOutput Declare var string exit Global var constant int multiply = 1, maxValue = 2147483647 Set answer = 1 Set base = 1 Set exp = 1   // determine if input fits in unsigned 32 bit int and set exit sentinel // //welcome message// Display “This program will determine the value of an integer (X) raised to the power of a second integer (N).” WHILE exit !=n //set repeat of input if error message is flagged and reset error flags// DO      SET errorInput = 0      Set errorOutput = 0 //user input prompts//     Display “Please Enter first integer: “          Input base     Display “Please enter second integer: ”            Input exp IF (base,exp) >= maxValue THEN    //error message// Display “ Error! Value exceeds maximum available input. Please enter a value less than 2147483647”   SET errorInput = 1  END IF WHILE errorInput = 1 //perform calculation with iterative multiplication// //check for error outputs & unneccessary execution of loop// IF exp != 0 THEN FOR (errorOutput ! =1 && multiply maxValue THEN SET  errorOutput = 1              END IF END FOR   //end calculation and check for maximum value......

Words: 266 - Pages: 2

Premium Essay

Intorduction to Programming Logic

...Introduction to Programming Logic Phillip M. Ragland June 20, 2016 Individual Projects Document Noura Abbas Individual Project 1 There are many steps and processes to consider when designing a website for a customer. Regardless if the customer is an individual or a large corporation, the steps and processes for designing a website are pretty much the same. Each website that is designed with similar specifications. However, when it comes to the design aspects of a website, it will differ greatly from customer to customer. Some of the cues that determine the design of the website are the intended purpose of the website, the intended audience of the website, and of course the desire of the customer it is being designed for. Here are some basic steps and processes for the design of a website: 1). Gathering information from the customer 2). Planning 3). Design 4). Development 5). Testing and delivery 6). Maintenance (iDesign Studios, 2016). The first step (phase) for designing a website is to gather information. When gathering information, you will need to ask a lot of questions. Question such as what id the purpose of the website? Who is the audience of the website? What is the intended accomplishment of the website? Many such questions as these will need to address. The next step (phase) is planning. During the planning step, you will use the information that was gathered during the 1st phase to begin to......

Words: 1820 - Pages: 8

Free Essay

Algorithms and Logic for Computer Programming

...Programming Solution Part 3: Array Structure Proposal Wayne Murray Algorithms and Logic for Computer Programming (PRG 211) November 14, 2011 Professor Sprouse Array Structure Proposal In my proposal from week two I would want to find the total number of units per patient for each procedure code billed by the doctor. A parallel array consisting of a one-dimensional and a two-dimensional array in this case would be a good way to solve this problem in a simplified code format. An array would also allow all the data the user wants to input to be stored in the program for multiple queries to be run without having to re-input the data. So this module of the program will allow the user to input all the different procedure codes billed the provider and return a units-per-patient statistic for the searched procedure code. Assuming the data that the user will input is all for the same provider, the following variables will need to be declared: the procedure code, the number of patients, and the number of units billed. Two arrays will be declared as well, one for the procedure code and one for the number of patients and units. The procedure code variable and array must be setup with a string data type since there are some procedure codes that have alpha characters. The number of patients and the number of units variables, as well as their corresponding array will be setup as integer data types. Since both of those variables are of the same data type they can be combined......

Words: 728 - Pages: 3

Flying Swords of the Dragon Gate (Cantonese) - 龍門飛甲Flying Swords of the Dragon Gate (Cantonese) | 4X Car Radio Door Clip Panel Trim Dash Audio Removal Installer Pry Tool Yellow | Transport- en bestelwagens