Pt1420 Unit 3 Homework

In: Computers and Technology

Submitted By clipsegst84
Words 715
Pages 3
Short Answer
1. What two things must you normally specify in a variable declaration? The variable’s name and data type
2. What value is stored in uninitialized variables? 0
Algorithm Workbench
3. Write assignment statements that perform the following operations with the variables a, b, and c.
a. Adds 2 to a and stores the result in b Set b= 2+a
b. Multiplies b times 4 and stores the result in a Set a= b*4
c. Divides a by 3.14 and stores the result in b Set b= 3.14/a
d. Subtracts 8 from b and stores the result in a Set 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 value will be stored in result in each of the following statements?
a. Set result = x + y = 4+8= 12
b. Set result = z * 2 = 2*2= 4
c. Set result = y / x = 8/4= 2
d. Set result = y – z = 8-2= 6

5. Write a pseudocode statement that declares the variable cost so it can hold real numbers.
Floating-point variable cost

6. Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0.
Declare Real price = 99.95
Display “The original price.”
Input originalPrice
Display price

7. Write a pseudocode statement that assigns the value 27 to the variable count.
Count:=27

8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total.
Declare Integer total= 0
Set total= 10+14
9. Write a pseudocode statement that subtracts the variable downPayment from the variable total and assigns the result to the variable due.
Declare Integer downPayment
Declare Integer total
Declare Integer due
Set due= total-downPayment

10. Write a pseudocode statement that multiplies the variable subtotal by 0.15 and assigns the result to the variable totalfee.
The variable totalFee
First make the variables Real…...

Similar Documents

Unit 3 Homework for Wan

...Configuration – routername(config-if)# Router Configuration – routername(config-line)# Basic Configuration Exercise 1. Router>enable Router#configure terminal Router(Config)#hostname AUS AUS(config)#end 2. AUS(config)# Enable Password class AUS(config)#Enable Secret class 3. Secret will supersede Password as the enable password. You do not need both, but you should have Secret over Password, as it is more secure. 4. AUS(config)#line con 0 AUS(config-line)#password cisco AUS(config-line)#login AUS(config-line)#line aux 0 AUS(config-line)#password cisco AUS(config-line)#login 5. AUS(config)#line vty 0 4 AUS(config)#password cisco AUS(config)#login 6. Aus(config)#service password-encryption 7. The secret password has stronger encryption than encrypting all passwords. 8. AUS(config)#line serial 0/0 AUS(config-if)#ip address 10.2.0.1 255.255.0.0 AUS(config-if)#clock rate 64000 AUS(config-if)#no shutdown 9. AUS(config)#interface fastethernet 0/0 AUS(config-if)#ip address 10.3.0.1 255.255.0.0 AUS(config-if)#no shutdown 11. AUS#copyrun start 12. show startup-config 14. Ping would be a good first choice. Show command Exercise 1. Show ip interface brief 2. Show interfaces 3. Show ip route 4. Show running-config 5. Show startup-config 6. The configuration in NVRAM is not lost when the router is rebooted and contains what configuration the router will have when it starts up. The running configuration is contained in RAM and......

Words: 339 - Pages: 2

Unit 3 Homework

...Short answer: 5. Variable type and identifier. 6. Some languages assign a default value as 0 to uninitialized variables. In many languages, uninitialized variables hold unkown values. Algorithm Workbench 3. a. Adds 2 to a and stores the result in b Set b= 2 +a b. Multiplies b times 4 and stores the result in a set a= b*4 c. Divides a by 3.14 and stores the result in b set b= 3.14/b d. Subtracts 8 from b and stored the result in a set a= b-8 4. 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. Floating-point variable cost 6. Initialize the variable with the value 0. Declare Real price=53.85 Display "the original price." Input item original price Display "price" 7. Count:=27 8. Set total=10+14 9. Declare Integer downPayment Declare Integer Total Declare Integer Due 10. Dim subtotal As Double = 0 totalfee = subtotal * 0.15 Programming Exercise: 6. Sales Tax Design a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county tax. Assume the state sales tax is 4 percent (.04) and the county tax is 2 percent (.02). The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of the purchase plus the total sales tax). int main { double amtPurch double stateTax double countryTax cout << "How much did you purchase?"; ...

Words: 412 - Pages: 2

Pt1420 Unit 8 Assignment 1: Homework

...critical that accumulator variables are properly initialized? An accumulator is used to keep a running total of numbers. In a loop, a value is usually added to the current value of the accumulator. If it is not properly initialized, it will not contain the correct total. 9. What is the advantage of using a sentinel? The advantage of using a sentinel is that when you are processing a long list of values with a loop a sentinel marks the end of a list of items. There is no limit to how many times a loop can execute. 10. Why must the value chosen for use as a sentinel be carefully selected? The value of a sentinel needs to be carefully selected because it can’t be mistaken as a regular value in the list. Algorithm Workbench: 3. // Declare a counter variable. Declare Integer // Constant for the maximum value Constant Integer MAX_VALUE = 100 //Display the multiples of 10 from 0 through 100 For counter = 0 to MAX_VALUE Display counter End For   4. //Declare Integer number Declare an accumulator variable Declare Integer total = 0 Declare Integer counter For counter = 1 to 10 Display “Enter a number.” Input number Set total = total + number End For Display “The total is”, total 9. Declare Integer count For count < 50 Display “The count is “, count Set count = 1 To 50 End For 10. //Declare integer count While count...

Words: 303 - Pages: 2

Unit 3 Assignment 1: Homework

...Dr. Davis PT1420 26 June 2014 Unit 3 Assignment 1: Homework 5. Write a pseudo code statement that declares the variable cost so that so that it can hold real numbers. a. declare real cost 6. Write a pseudo code statement that declares the variable total so that it can hold integers. Initialize the variable with value zero. a. Declare real price = 0.00 display “the original price” input items original price display “price” 3. Write assignment statements that perform the following operations with variables a, b and c. a. set b = a+2 b. set a = b*4 c. set b = a/3.14 d. set a= b-8 7. Write a pseudo code statement that assigns the value 27 to the variable count. A count: = 27 8. Write pseudo code statement that assigns the sum of 10 and 14 to the variable total. a. declare integer total set total = 10+14 display total 9. Write a pseudo code statement that subtracts the variable down payment from the variable total and assigns the result for the variable due. a. declare integer down payment declare integer total declare integer due set due = total – down payment display “down payment “ input down payment 10. Write a pseudo code statement that multiplies the variable subtotal by 0.15 and assigns the result to the variable total fee a. declare real subtotal declare real totalfee set totalfee subtotal * 0.15 display “subtotal” input subtotal display totalfee 4. Assume the variable result,...

Words: 550 - Pages: 3

Unit 3 Assignment 1: Homework

...Kurt Trotter PT1420 Unit 3 Assignment 1 Week 3 07/06/2104 Homework Short Answers 5. You must specify type & name. 6. An uninitialized variable is by default a 0. Algorithm Workbench Review Questions 3) Write assignment statements that perform the following operations with the variable a, b and c. a) Adds 2 to a and stores the result in b. { b = 2 + a } b) Multiplies b by 4 and stores the result in a. { a = b * 4} c) Divides a by 3.14 and stores the result in b. { b = a MOD 3.14 } d) Subtracts 8 from b and stores the result in a { a = 8 – b } 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 value will be stored in result in each of the following statements? a) 12 = x + y b) 4 = z * 2 c) 2 = y / x d) 6 = y – z 5) Write a pseudocode statement that declares the variable cost so it can hold a real numbers. Dim cost1 As Double = 0 6) Write pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Dim cost1 As Integer = 0 7)Write a pseudocode statement that assigns the value 27 to the variable count. Dim count As Integer = 27 8) Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total. Total = 10 + 14 9) Write a pseudocode statement that subtracts the variable downpayment from the variable total and assigns the result to the variable due. due = downpayment – total 10) Write a pseudocode statement that...

Words: 417 - Pages: 2

Pt1420 Unit 3

...Short Answer: 5. The variable’s name and the variable’s data type must be specified in a variable declaration. 6. The value of an uninitialized variable is either 0 or the value that happens to be stored in its memory location. Algorithm Workbench: 3. a. Set b = 2 + a b. Set a = b * 4 c. Set b = a / 3.14 d. Set a = b – 8 4. a. 12 b. 4 c. 2 d. 6 5. Declare Real cost 6. Declare Int total = 0 7. Set count = 27 8. Set total = 10 + 14 9. Set due = downPayment – total 10. Set totalFee = subtotal * .015 Programming Exercise: 6. Declare Real purchaseAmt Constant Real STATE_TAX = 0.04 Constant Real COUNTY_TAX = 0.02 Declare Real totalTax Declare Real totalSale Display “Enter the amount of purchase” Input purchaseAmt Set stateTax = purchaseAmt * stateTax Set countyTax = purchaseAmt * countyTax Set totalTax = stateTax + countyTax Set totalSale = purchaseAmt * totalTax Display “The amount of your purchase is $”, purchaseAmt, Display “The state tax is $”, stateTax Display “The county tax is $”, countyTax Display “total tax is $”, totalTax Display “The total of the sale is $” totalSale 8. Declare Real mealAmt Constant Real TIP = 0.15 Constant Real SALES_TAX = 0.07 Display Real taxTotal Declare Real totalSale Display “Enter the price of the meal” Input mealAmt Set salesTax = mealAmt * salesTax Set tip = mealAmt * tip Set totalTax = salesTax + tip Set totalSale =......

Words: 254 - Pages: 2

Pt1420 Unit 3 Assignment 1 Homework

...Unit 3 Assignment 1 Homework Short Answer: 5. What two thing must you normally specify in a variable declaration? * You must specify the variable type and an identifier. * int n; // type - int, identifier - n 6. What value is stored in uninitialized variables? * is a variable that is declared but is not set to a definite known value before it is used. Algorithm Workbench pg71-72 3) Write assignment statements that perform the following operations with the variable a, b and c. a) Adds 2 to a and stores the result in b. { b = 2 + a } b) Multiplies b by 4 and stores the result in a. { a = b * 4} c) Divides a by 3.14 and stores the result in b. { b = a MOD 3.14 } d) Subtracts 8 from b and stores the result in a { a = 8 – b } 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 value will be stored in result in each of the following statements? a) 12 = x + y b) 4 = z * 2 c) 2 = y / x d) 6 = y – z 5) Write a pseudocode statement that declares the variable cost so it can hold a real numbers. Dim cost1 As Double = 0 6) Write pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Dim cost1 As Integer = 0 7)Write a pseudocode statement that assigns the value 27 to the variable count. Dim count As Integer = 27 8) Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total. Total = 10 + 14 9) Write a......

Words: 577 - Pages: 3

Pt1420 Unit 1 Assignment 1 Homework

... The typical hardware associated with a computer includes but are not limited to input devices such as mice, keyboards and webcams. Output devices like monitors, speakers and printers and your different types of memory (CPU, RAM, SSDs.) The computer’s data storage process consists of tiny electrical power charges in microscopic capacitors. When a computer is turned off the capacitors that your data is stored on lose their charge which is why computer memory goes blank when it is off. For data that is stored for longer periods of time, it is stored as a magnetic pattern on a spinning disk. A program is a set of instructions that a computer follows in order to perform a task. A program is run by the computer’s CPU or Central Processing Unit. Each instruction in a program tells the CPU to perform a specific operation. Machine Language: Language that CPU understands. It is always written in binary. Assembly Language: Language that consists of short words known as mnemonics. It was created because it was impractical for people to write programs in machine language. High-Level Language: Allows people to create powerful and complex programs without knowing how the CPU works, and without writing large numbers of low-level instructions. Compiler: Program that translates a high-level language into a separate machine language program. Interpreter: Program that both translates and executes the instructions in a high-level program. As described earlier in this paper, I......

Words: 287 - Pages: 2

Pt1420 Unit 3 Assignment 1

...Jairo Granado Prof. M. Ashraf PT1420 March 28, 2015 Unit 3 Assignment 1: Homework Short Answer 1. What two things must you normally specify in a variable declaration? You must specify type & name. 2. What value is stored in uninitialized variables? An uninitialized variable is by default a 0. Algorithm Workbench 3. Write assignment statements that perform the following operations with the variable a, b and c. a) Adds 2 to a and stores the result in b. { b = 2 + a } b) Multiplies b by 4 and stores the result in a. { a = b * 4} c) Divides a by 3.14 and stores the result in b. { b = a MOD 3.14 } d) Subtracts 8 from b and stores the result in a { a = 8 – b } 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 value will be stored in result in each of the following statements? a) 12 = x + y b) 4 = z * 2 c) 2 = y / x d) 6 = y – z 5. Write a pseudocode statement that declares the variable cost so it can hold a real numbers. Dim cost1 As Double = 0 6. Write pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Dim cost1 As Integer = 0 7. Write a pseudocode statement that assigns the value 27 to the variable count. Dim count As Integer = 27 8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total. Total = 10 + 14 9. Write a pseudocode statement that subtracts the variable downpayment from the variable total......

Words: 533 - Pages: 3

Pt1420 Programming Unit 10 Research & Homework

...Unit 10: Homework and Research Assignment Definition Decision Structure - allows a program to perform actions only under certain conditions. Boolean expression - expressions that can be evaluated as either True or False Iteration - is the repetition of a block of statements within a computer program. Counter-controlled repetition structure - used when a program needs to repeatedly process one or more instructions until some condition is met, at which time the loop ends. Many programming tasks are repetitive, having little variation from one item to the next.  Condition controlled - Most programming languages have constructions for repeating a loop until some condition changes. Note that some variations place the test at the start of the loop, while others have the test at the end of the loop.  Pre – test loop - the condition gets evaluated at the beginning of the loop cycle. Therefore, the body of the loop will not get executed if the condition does not hold the very first time. Post – Test loop - the loop condition gets evaluated at the end of the loop cycle. Therefore, the body of the loop will get executed at least once, regardless of the condition. This is a major difference between a pretest loop and a posttest loop. You may choose a posttest loop if the problem description justifies the body of the loop be executed at least once. Repetition Sequence/ Set of statements - A repetition structure causes a statement or set of statements to......

Words: 1912 - Pages: 8

Unit 10 Homework Pt1420

...Unit 10 Assignment Homework PT1420 Intro to Programming True or False 1. When working with a sequential access file, you can jump directly to any piece of data in the file without reading the data that comes before it. False 2. In most languages, when you open an output file and that file already exists on the disk, the contents of the existing file will be erased. True 4. The purpose of an EOF marker is to indicate where a field ends. Files typically contain several EOF markers. False 5. When an input file is opened, its read position is initially set to the first item in the file. True Algorithm Workbench 1. Design a program that opens an output file with the external name my_ name. dat, writes your name to the file, and then closes the file. Declare an internal name for an output file. 2 Declare OutputFile myFile 3 4 // Declare the variable to hold values 5 // that will be read from the file 6 Declare String name 7 8 // Open a file named my_name.dat on 9 // the disk 10 Open myFile “my_name.dat” 11 12 // Write your name to the file 13 Write myFile “Your Name” 14 15 // Close the file 16 Close myFile 2. Design a program that opens the my_ name. dat file that was created by the algo-rithm in question 1, reads your name from the file, displays the name on the screen, and then closes the file. Declare InputFile myName Declare String name Open myName "my_Name.dat" Display "Your name is: " While NOT eof (myName) Read......

Words: 610 - Pages: 3

Pt1420 Unit 3 Lab

...Lab 3.1 Step 1: Variable Name | Problem (Yes or No) | If Yes, what’s wrong? | Declare Real creditsTaken | No | | Declare Int creditsLeft | Yes | Int should be real | Declare Real studentName | Yes | Real should be string | Constant Real credits needed = 90 | Yes | Credits needed should be one word | Step 2: There is no Set keyword used prior to the equation Should be Set creditsLeft = creditsNeeded - creditsTaken Step 3: The student’s name is Nolan Owens Step 4: This program requires 90 credits and they have taken 20 credits so far. Step 5: 1. //Provide documentation on line 2 of what this program does 2. //This program calculates the credits the student has left before graduation 3. //Declare variables on lines 4, 5, 6, and 7 4. Declare Real creditsTaken 5. Declare Real creditsNeeded 6. Declare Real creditsLeft 7. Declare String studentName 8. //Ask for user input of studentName and creditsTaken on line 9 - 12. 9. Input studentName 10. Input degreeName 11. Input creditsNeeded 12. Input creditsTaken 13. //Calculate remaining credits on line 14 14. Set creditsLeft = creditsNeeded - creditsTaken 15. //Display student name and credits left on line 16 and 17 16. Display “The student’s name is”, studentName 17. Display “This means there are”, creditsLeft, “left until graduation.” Lab 3.2 Lab 3.3 Module Module1 Sub Main() 'local variables used in this program Const......

Words: 275 - Pages: 2

Pt1420 Unit 1 Homework

...Jonathan Ford Intro to Programming Unit 1 Homework 4/13/16   1. Why is the CPU the most important component in a computer?       a. Without the CPU, the computer could not run software. The CPU is the part of the computer that actually runs the programs. (pg. 3)   2. What number does a bit that is turned on represent? What number does a bit that is turned off represent?       b. 1 represents a bit that is turned ON. 0 represents a bit that is turned OFF. (pg. 8)   3. What would you call a device that works with binary data?       c. A device that works with binary data is called a DIGITAL device. (pg. 11)   4. What are the words that make up a high-level programming language called?       d. The words that make up a high-level programming language are known as KEY WORDS or RESERVED WORDS. (pg. 17)   5. What are the short words that are used in assembly language called?       e. The short words that used in assembly language are called MNEMONICS. (pg. 14)   6. What is the difference between a compiler and an interpreter?       f. A COMPILER is a program that translates a high-level language program into a separate machine language program. An INTERPRETER is a program that both translates and executes the instructions in a high-level language program. (pg. 17-18)   7. What type of software controls the internal operations of the computer’s hardware?       g. An operating system controls the internal operations of the computer’s hardware....

Words: 254 - Pages: 2

Pt1420 Unit 1 Assignment 1 Homework

...Unit 1 Assignment 1: Homework Short Answer 1. Why is the CPU the most important component in a computer? The CPU is the most important part of the computer is that it runs the programs, without it a computer cannot run software. 2. What number does a bit that is turned on represent? What number does a bit that is turned off represent? A bit that is on is represented by the digit 1 and a bit that is off is represented by the digit 0. 3. What would you call a device that works with binary data? 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? Key words or reserved words have specific meaning and purpose in the programming language. 5. What are the short words that are used in assembly language called? Assembly language uses short words that are known as mnemonics. 6. What is the difference between a compiler and an interpreter? Compiler is a program that translates high-level language program into a separate machine language program. An interpreter is a program that both translates and executes the instructions in a high-level language program. 7. What type of software controls the internal operations of the computer’s hardware? An operating system is the most fundamental set of programs on a computer. The operating system controls the internal operations of the computer’s hardware, manages all of the devices connected to the computer, allows data to be saved to and......

Words: 272 - Pages: 2

Pt1420 V1 Unit 2 Assignment 1: Homework

...Unit 2 Assignment 1 Pt1420 Unit 2 Assignment 1: Homework Kenneth D. Davis Intro to Programming Short Answer 1. What does a professional programmer usually do first to gain an understanding of a problem? Interview the customer 2. What is pseudocode? Fake Code 3. Computer programs typically perform what three steps? 1. Input is received. 2. Some process is performed on the input. 3. Output is produced. 4. What does the term “user- friendly” mean? The term user- friendly is commonly used in the software business to describe pro-grams that are easy to use. Programs that do not display adequate or correct instruc-tions are frustrating to use, and are not considered user- friendly. One of the simplest things that you can do to increase a program’s user- friendliness is to make sure that it displays clear, understandable prompts prior to each statement that reads keyboard input. 5. What two things must you normally specify in a variable declaration? You must specify the variable type and an identifier 6. What value is stored in uninitialized variables? Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values. Algorithm Workbench 1. Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height. Set height = 72” Display ‘Enter your Height at Age 21’ Input hEIGHT Display ‘Enter your Height......

Words: 319 - Pages: 2

Mèo Cầu Vồng | Download | Internet Impacts on Global Business