Intro to Programming

In: Computers and Technology

Submitted By refsy1z
Words 300
Pages 2
Unit 3: Lab 3.1
Course Intro to programming
Instructor : Sindar

Lab 3.1

Lab 3.1
Step 1 Identify potential problems.
Variable Name Problem Yes/No if yes, what’s wrong?
Declare Real credits Taken No
Declare Int cedits Left Yes We need to be able to use decimal as well.
Declare Real studentName No
Constant Real creditsNeeded=90 No

Step 2
What’s wrong with this calculation Set credits-Left = credits-Taken – credits-Needed It should be: Set credits-Left = credits-Needed – credits-Taken
Step 3
Write the exact output you would expect from the following code if the user of the program enters “John Brown”. Display “The student’s name is “, studentName Output will be “The student’s name is, John Brown
Step 4
Write the exact output from the following line of code if user of the program enters John Brown and they have taken 20 credits so far. Display “The Network Systems Administration degree is awarded after 90 credits and “, studentName, “ has “, creditsLeft, “ left to take before graduation.” Output “ The Network Systems Administration degree is awarded after 90 credits and John Brown has 70 left to take before graduation.
Step 5
1. //Provide documentation on line 2 of what this program does
2. //This program displays student information and degree program information
3. //Declare variables on lines 4, 5, 6, and 7
4. //Declare Real studentName
5. //Declare Real creditsTaken
6. //Constant Real creditsNeeded = 90
7. //Declare Real creditsLeft
8. //Ask for user input of studentName and creditsTaken
9. //Display “ What is the students name?”
10. //Input studentName
11. //Display “ How many credits have been taken?”
12. //Input creditsTaken
13. //Calculate remaining credits on line 14
14. //Set creditsLeft = creditsNeeded – creditsTaken
15.…...

Similar Documents

Intro to Programming

...1. Using a similar approach as example 2.3 (textbook page 75): “Finding the Sale Price of Items in a Department Store”, provide your analysis for the following problem statement: You need to write a program that will calculate the number of square feet (living space) in a 4-room house. Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed. In this Program, the aim is to calculate the square feet of a 4 room house So we need to know each rooms length and breadth , then calculate each rom’s area and the find the sum of those • Area of Room1=length1*width1 • Area of Room2=length2*width2 • Area of Room3=length3*width3 • Area of Room4=length4*width4 Total Number of Square Feet = Area of Room1+ Area of Room2+ Area of Room3+ Area of Room4 2. Using a similar approach as the example provided in section 2.2(textbook page 78) for “The Sale Price Program continued”, provide your program design for the program you analyzed for calculating the number of square feet in a house. Be sure to describe the fundamental tasks needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that......

Words: 295 - Pages: 2

Intro to Programming

...computer? The central processing unit, or CPU, is the part of a computer that actually runs programs. The CPU is the most important component in a computer because without it, the computer could not run software. 2. What number does a bit that is turn on represent? What does a bit that is turned off represent? In computer systems, a bit that is turned off represents the number 0 and a bit that is turned on represents the number 1. 3. What would you call a device that works with binary data? Digital data is data that is stored in binary, and a digital device is any device that works with binary data. 4. What are the words that make up a high-level programming language called? Each high-level language has its own set of predefined words that the programmer must use to write a program. The words that make up a high-level programming language are known as key words or reserved words. Each key word has a specific meaning, and cannot be used for any other purpose. 5. What are the short words that are used in assembly language called? Instead of using binary numbers for instructions, assembly language uses short words that are known as mnemonics. 6. What is the difference between a compiler and a interpreter? Typically, the programmer types a program’s code into a text editor and then saves the code in a file on the computer’s disk. Next, the programmer uses a compiler to translate the code into a machine language program, or an interpreter to translate and execute the code.......

Words: 416 - Pages: 2

Intro to Programming

...a value. 18. Defense programming: A practice of anticipating errors that can happen while a program is r unning, and designing the program to avoid those errors. 19. Error trap: A validation loop is also known as an error trap. 20. Input Validation: The process of validating the data that is entered as input. 21. Output file: A file that is written to. It is called an output file because the program stores out-put in it. 22. Input file: A file that data is read from. It is called an input file because the program gets input from the file. 23. Processing a file: When data is either written to the file or read from the file. 24. Text file: A file that contains text. 25. Sequential access: Sequential access means that data is read from the beginning of a file to the end. And to access data anywhere in that file must be read from the beginning to the point where the desired data. 26. Direct access: Also known as random access means you can go directly to any piece of data in a file without having to read from the beginning of that file. 27. Filename extension: A short sequence of characters that appear at the end of a filename. (.txt, .jpg, .doc). The extension indicates the type of data stored in the file. For example .doc is for MS Words document. 28. Flow chart rectangle symbol: A flowchart rectangle shows a process, action, or task. 29. File append mode: The file append mode in programming means you can if you......

Words: 834 - Pages: 4

Intro to Programming

...Intro to programming final study guide 1. Name the components of a computer: CPU, RAM, Secondary storage devices, Input devices, Output devices 2. What does a disk drive do? A disk drive stores data by magnetically encoding it onto a circular disk. 3. What is the largest value that can be stored in a bit? 255 4. What is ASCII? ASCII is the American Standard Code for Information Interchange which is a set of 128 numeric codes that represent the English letters, various punctuation marks, and other characters 5. What is machine language? Machine language is written in 1s and 0s and known as binary. 6. How does a computer execute instructions? The computer uses the fetch-decode-execute cycle. 7. What is assembly language? Assembly language uses short words that are known as mnemonics instead of binary. 8. What is syntax? Syntax is a set of rules that must be strictly followed when writing a program. 9. What is an interpreter? An interpreter is a program that both translates and executes the instructions in a high level language program 10. What is a logic error? A logic error is a mistake that does not prevent the program from running, but causes it to produce incorrect results. 11. What is an algorithm? An algorithm is a set of well defined logical steps that must be taken to perform a task. 12. What is Pseudocode? Pseudocode is fake code. 13. What are the symbols used in a flowchart? The Ovals which are called terminal symbols that start and stop something,......

Words: 771 - Pages: 4

Intro to Programming

...Individual Project Professor IT106-1401A-05: Introduction to Programming Logic Contents Phase 1 3 Deposit 3 Transfer 3 Phase 2 4 Problem Analysis Chart 4 Inquiry 4 Deposit 4 Transfer 4 Structure Chart 4 IPO 4 Inquiry 4 Deposit 4 Transfer 4 Coupling Diagram 4 Data Dictionary 4 Phase 3 5 Inquiry 5 Flowchart 5 Pseudocode 5 Deposit 5 Flowchart 5 Pseudocode 5 Transfer 5 Flowchart 5 Pseudocode 5 Phase 4 6 Flowchart 6 Pseudocode 6 Phase 5 7 Inquiry 7 Deposit 7 Transfer 7 Phase 1 Part 2: Determine current amount available in checking account (balanceChecking)-$50.00 Determine what the transfer amount will be (transferAmount)-$25.00 Retrieve the transaction number for confirmation (transactionNumber)-54643635345 Phase 2 Problem Analysis Chart Given Data | Required Results | Account number and PIN | Account Balance | Processing Required | Solution Alternatives | 1. Access banking systems to retrieve data 2. Provide to customer | 1. Have an automated system that emails balance info as opposed to displaying it. | Structure Chart Account information | VerifyInfo | Provide info | AccessInfo | Locate Retrieve PIN Display Info IPO Input | Processing | Module Reference | Output | Account numberWhich......

Words: 315 - Pages: 2

Intro to Programming Unit 1 Research Assignment

... Niklaus Wirth. The specific motivation behind this language was to encourage good programming practice using structured programming and data structuring. 2) SQL (Structured Query Language) designed by, Donald D. Chamberlin, and Raymond F. Boyce. The motivation behind this language was designed for managing data held in a relational database management system. ( RDBMS) 3) C, Designed by Dennis Ritchie. the motivation behind this language is structured programming and allows lexical variable scope and recursion. 4) Applesoft BASIC, developed by Marc McDonald, and Ric Weiland. The motivation with this language was it was designed to be backwards-compatible with integer BASIC and used the core of Microsoft’s 6502 BASIC implementation. 5) GRASS, Developed by Thomas A. DeFanti. GRASS is similar to BASIC in sytax, but added numerous instructions for specifying 2D object animation, including scaling, translation, rotation and color changes over time. 1980’s 1) BASICA, Designed by Thomas E. Kurtz. Designed to offer support for the graphics and sound hardware of the IBM PC line. 2) Turbo Pascal, developed by Borland, under Philippe Kahn’s leadership. This is a software development system that includes a compiler and an integrated development environment for the Pascal programming language. 3) C++, designed by Bjarne Stroustrup. This is a general purpose programming language that is free-form and compiled. It is regarded as an intermediate-level......

Words: 677 - Pages: 3

Unit 3 Intro to Programming Homework

...“&” to the command. 2. What is a PID number? Why are these numbers useful when you run processes in the background? Which utility displays the PID numbers of the commands you are running? An identification number that is automatically assigned to each process when it is created on the Linux operating system. I personally don’t think that the PID is particularly useful, but they are required to use the kill command. The PS command displays the PID numbers. 3. Assume that the following files are in the working directory: $ ls intro notesb ref2 section1 section3 section4b notesa ref1 ref3 section2 section4a sentrev *Give commands for each of the following, using wildcards to express files names with as few characters as possible. a. List all files that begin with section. $ ls section* b. List the section1, section2, and section3 files only. $ ls section[1-3] c. List the intro file only. $ ls i* d. List the section1, section3, ref1, and ref3 files. $ ls *[13] 4. Give an example of a command that uses grep. In which of the preceding cases is grep used as a filter? A. With both input and output redirected. $ grep \$Id < *.c > id_list B. With only input redirected. $ grep -i suzi < addresses C. With only output redirected. $ grep -il memo *.txt > memoranda_files D. Within a pipe. $ file /usr/bin/* | grep "Again shell script" | sort -r In which of the preceding is grep used......

Words: 1208 - Pages: 5

Intro to Programming Lab 1

...Exercise 1.3.1 What is the decimal value of Byte 1 by itself? What is the decimal value of Byte 2 by itself? Answer: 25, 233 Exercise 1.5.1 On the desktop of your operating system, create a new folder called Classes. Open the C: drive and locate the path through the subfolders from the root directory C: to get to your Classes folder. This path will differ slightly depending on the operating system. Record the navigation path to get to your new Classes folder. Hint: Most directory structures that include the desktop of a computer involve finding a folder for users and selecting the correct user. Answer: click on start, then computer, then desktop and the “Class” file is there. Exercise 1.5.2 Open the Classes folder you created and move the myname. txt file to the Networking folder. What has happened to the OS reference to the location of the file myname. txt? What has happened to the physical storage location of myname. txt in memory? Answer: 1. The OS reference has been moved from the main folder “Classes” to the sub folder “Networking” 2. The os reference is now under the sub folder Networking in memory. Exercise 1.6.1 Record the amount of space you have available and how much total space you have on your Windows hard drive. Answer: 417 GB free if 465 GB. Exercise 1.6.3 Locate the system information for your Windows machine and record the amount of RAM you have installed. Answer: 4.00 GB of RAM Exercise 1.6.5 Access the System Information window on your Windows......

Words: 421 - Pages: 2

Intro to Programming Concepts

...Class | Attributes | Responsibilities | Operations | BookTextbookPicturebook | ISBNAuthorTitlePriceRangeAge | Receive Book DataValidate Book DataSelect and Print DataReceive Book DataValidate DataSelect and Print DataReceive Book DataValidate Book DataSelect and Print Data | +setBook-Over$50+validatePrice+setBook-GradeRange3to6+validateGrade+setBook-AgeRange3to6+validateAge | UML Book | -ISBN-Author-Title-Price | +over$50( ) | TextBook | -Grade | +GradeRange3to6( ) | PictureBook | -Age | +AgeRange3to4( ) | Book Class START setBook(inISBN, inAuthor, inTitle, inPrice) ISBN= inISBN Aurthor= inAuthor Title= inTitle Price= inPrice END START Over$50 validatePrice(validInput) IF validInput AND Price > 50.00 THEN Print ISBN, Author, Title, Price ENDIF END START validatePrice validate=true IF Price Not numeric THEN validInput=false Display ‘Invalid Price’, Price ENDIF END Book Driver Algorithm START testBook Create Book 1 as new Book( ) inISBN= 111111 inAuthor= ‘Test Aurthor’ inTitle= ‘Test Title’ inPrice= 55.99 Book 1.setBook(inISBN, inAuthor, intitle, inPrice) Book1.Over$50( ) END START TextBook class setTextBook(inISBN, inAuthor, inTitle, inPrice, inGrade) ISBN= inISBN Aurthor= inAurthor Title= inTitle Price=......

Words: 1298 - Pages: 6

Unit 5 Research Paper for Intro to Programming

...NT 1310 | October 16 2014 | Phillip Wilson | Mr. Covington | A shell script is just a text file full of commands. It must be executable. A shell script is also a computer program designed to be run by the Unix shell, a command line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. Writing a shell script is much quicker than writing the equivalent code in other programming languages. The many advantages include easy program or file selection, quick start, and interactive debugging. A shell script can be used to provide sequencing and decision-making linkage around existing programs, and for moderately-sized scripts the absence of a compilation step is an advantage. Interpretive running makes it easy to write debugging code into a script and rerun it to detect and fix bugs. Non-expert users can use scripting to tailor the behavior of programs, and shell scripting provides some limited scope for multiprocessing. Most common usage methods of PowerShell are interactive console (powershell.exe) and script files (with extension of .ps1 that is also usually executed by powershell.exe). Main features of PowerShell are: .Net integration, object pipeline, easy access to many management domains (WMI, ADSI, COM, .NET etc.) and standardization that brings easy discovery and quick learning of new features after you know base......

Words: 311 - Pages: 2

Intro to Programming Chapter 5 Short Answer Questions

...is an example of an If-Then statement that uses the AND operator: If temperature < 20 AND minutes > 12 Then Display “The temperature is in the danger zone.” End If 5) Briefly describe how the OR operator works. The OR operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the sub-expressions is true. The following is an example of an If-Then statement that uses the OR operator: If temperature < 20 OR temperature > 100 Then Display “The temperature is in the danger zone.” End If 6) When determining whether a number is inside a range, which logical operator is it best to use? The AND Operator. 7) What is a flag and how does it work? In programming, a flag is a predefined bit or bit sequence that holds a binary value. Typically, a program uses a flag to remember something or to leave a sign for another program. For example, in a message being exchanged by two programs, a three-bit flag's field or data area might be set to one of three configurations: 001 (meaning "I'm a self-contained message") 011 (meaning "I'm one of several chunks of data in this message") 111 (meaning "I'm the last chunk of data in this message")...

Words: 411 - Pages: 2

Intro to Programming Usin Java

...Introduction to Programming Using Java Course Specifications Course length: 1.0 day(s) Course Description Course Objective: You will learn the basic concepts of programming using Java as the tool for learning. Target Student: This course is intended for students with no prior academic background in a field other than computer science or programming, who wish to embark on a course of study that will prepare them for employment as professional software developers. Students who interact on a business basis with software development professionals and need to improve communication through better understanding of the concepts and terminology used by professional programmers will also benefit equally. Prerequisites: Students should be familiar with using personal computers with a mouse and keyboard. Basic typing skills are mandatory. Students should be comfortable in the use of the Windows 2000, Windows XP, Windows Vista environment, or Windows 7 environment. To ensure your success in this course, we recommend that you take the following Element K courses or have equivalent experience: Microsoft Windows Vista: Level 1Microsoft Windows XP Professional: Level 1 Course Objectives Upon successful completion of this course, students will be able to: · explore various programming concepts. · create simple programs. · use methods to define the behavior of classes. · implement the object-oriented methodology. · handle errors in a program. Course Content Lesson 1:......

Words: 323 - Pages: 2

Intro to Programming

...Program Description: This program will calculate total usable area of a house by summing the square feet of rectangular rooms. This requires inputs in the form of length and width dimensions of each room to find the area of each room then adding those numbers together to find the area of all rooms. The results will be the output in area of each room and the total area of all the rooms. Analysis: The area of each room is found using the equation Area=Length x Width. The output in total square feet is found by summing the output of the individual rooms. L = Length of room W = Width of room Area= (L) * (W) R1 = Room 1, L1 * W1 R2 = Room 2, L2 * W2 R3 = Room 3, L3 * W3 Define 3 integer numbers as area of each room: R1, R2, R3 Usable area will store the sum in total square feet of R1, R2, R3 Test Plan The following input is required for testing: Test Case 1: R1: L = 10, W = 12, L*W = 120 R2: L = 10, W = 10, L*W = 100 R3: L = 12, W = 12, L*W = 144 Usable Area: R1 + R2 + R3 = 364 square feet Test Case 2: R1: L = 10, W = 12, L*W = 120 R2: L = 11, W = 11, L*W = 121 R3: L = 12, W = 12, L*W = 144 Usable Area: R1 + R2 + R3 = 385 square feet Pseudocode // This program will add together the square feet of rooms to determine the total square feet of a house. // Declare variables Declare R1, R2, R3, Usable Area as Integer // Set values of Integers //The values for R will be found using L x W for each Room Set R1 = 120 Set R2 =......

Words: 317 - Pages: 2

Intro to Programming

...in set a. (a=bx4)  C: Divides a by 3.14 and stores the result in b (b=3.14/b)  D: Subtracts 8 from b and stores the result in a (a=b-8) 4. Assume the variables result, w,x, y, and z are all integers, and that w= 5, x= 4, y=8 and z=2. What will the values be stored in result in each of the following statements? a. set result= x+y= 4+8 b. set result=z*2= 2*2 c. set result= y/x= 8/4 set result= y-z= 8-2 5. Write a pseudocode statement that declares the variable cost so it can hold real numbers. Floating-point variable cost 6. Display the original price – Input the original price and display the price Write a pseudocode statement that declares the variable cost so it can hold real numbers: Floating point variable cost 6:  Programming Exercise Questions 6 and 8 on page 73 Required Resources  Textbook Submission Requirements Submit your written answers to your instructor at the beginning of Unit 4....

Words: 747 - Pages: 3

Intro to Programming Chapter Three Homework

... | | | 4. In a structured program, any structure can be nested within another structure.   | a.  | True |   | b.  | False | | | | 5. A structured program must contain a sequence, selection, and loop structure.   | a.  | True |   | b.  | False | | | | 6. Because you may stack and nest structures while retaining the overall structure, it might be difficult to determine whether a flowchart as a whole is structured.   | a.  | True |   | b.  | False | | | | 7. As a general rule, an eof question should always come immediately after an input statement because the end-of-file condition will be detected at input.   | a.  | True |   | b.  | False | | | | 8. Structured programming is sometimes called goto-less programming.   | a.  | True |   | b.  | False | | | | 9. No matter how complicated it is, any set of steps can always be reduced to combinations of the two basic structures of sequence and loop.   | a.  | True |   | b.  | False | | | | 10. The case structure is a variation of the sequence structure and the do loop is a variation of the while loop.   | a.  | True |   | b.  | False | | | | 11. Programs that use __C___ code logic are unstructured programs that do not follow the rules of structured logic.   | a.  | case | b.  | loop |   | c.  | spaghetti | d.  | nested | | | | 12. With a(n) __C__, you perform an action or task, and then you perform the next action, in order.   | a. ...

Words: 1129 - Pages: 5