Computer Science: An Overview (13th Edition) (What's New in Computer Science)
13th Edition
ISBN: 9780134875460
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2.6, Problem 1QE
The hypotenuse example script truncates the sides to integers, but outputs a floating-point number. Why? Adapt the script to output an integer.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a code in JavaScript to calculate the area of a sphere with output.
Create a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum.
Take sample values as, (12,10) and (13,13) to test the code.
Modify the code code_01_03.py by changing the magnitude contributions of the sine and cosine so that the sum of the magnitude factors is always 10. Experiment with different combinations. What happens to the generated signal? How is its magnitude? How is its frequency? In particular, how is the phase in each case?
import numpy as np#import scipy.signal as signalimport matplotlib.pyplot as pltif __name__ == '__main__':# Test bench areaprint ("Hello")t = np.arange(0.0, 0.05, 0.05/100 )s1 = 5*np.cos(2*np.pi*100*t)+5*np.sin(2*np.pi*100*t)plt.figure(1)plt.plot(t, s1, '-')# plt.title('Sign')plt.xlabel('Time[s]')plt.ylabel('Amplitude')S1=np.fft.fft(s1)f=np.arange(0.0, 1.0 , 1.0/50)plt.figure(2)plt.stem(f,abs(S1[0:50]))plt.xlabel('Normalized Frequency f_s/2')plt.ylabel('Magnitude')fase = np.angle(S1)y= [fase[5]]x=[0.1]plt.figure(3)plt.stem(x,y)plt.xlabel('Normalized Frequency a f_s/2')plt.ylabel('Fase [rad]')plt.show()
Chapter 2 Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Ch. 2.1 - What sequence of events do you think would be...Ch. 2.1 - What information must the CPU supply to the main...Ch. 2.1 - Prob. 3QECh. 2.2 - Prob. 1QECh. 2.2 - In the text, JUMP instructions were expressed by...Ch. 2.2 - Is the instruction If 0 equals 0, then jump to...Ch. 2.2 - Write the example program in Figure 2.7 in actual...Ch. 2.2 - The following are instructions written in Vole...Ch. 2.2 - What is the difference between the instructions...Ch. 2.2 - Here are some instructions in English. Translate...
Ch. 2.3 - Prob. 1QECh. 2.3 - Suppose the Vole memory cells at addresses 0xB0 to...Ch. 2.3 - Suppose the Vole memory cells at addresses 0xA4 to...Ch. 2.3 - Suppose the Vole memory cells at addresses 0xF0 to...Ch. 2.4 - Prob. 1QECh. 2.4 - Prob. 2QECh. 2.4 - Prob. 3QECh. 2.4 - a. Suppose you XOR the first 2 bits of a string of...Ch. 2.4 - Prob. 5QECh. 2.4 - Prob. 6QECh. 2.4 - Prob. 7QECh. 2.4 - Prob. 8QECh. 2.4 - Prob. 9QECh. 2.4 - Prob. 10QECh. 2.4 - Using Vole machine language (Appendix C), write a...Ch. 2.4 - Prob. 12QECh. 2.5 - Prob. 1QECh. 2.5 - Prob. 2QECh. 2.5 - Prob. 3QECh. 2.6 - The hypotenuse example script truncates the sides...Ch. 2.6 - Prob. 2QECh. 2.6 - The Python built-in function str () will convert a...Ch. 2.6 - Use the Python built-in bin () to write a script...Ch. 2.6 - Prob. 6QECh. 2.7 - Referring back to Questions 3 of Section 2.3, if...Ch. 2.7 - Prob. 2QECh. 2.7 - Suppose there were two central processing units...Ch. 2 - a. In what way are general-purpose registers and...Ch. 2 - Answer the following questions in Vole machine...Ch. 2 - Prob. 3CRPCh. 2 - What is the value of the program counter in the...Ch. 2 - Prob. 5CRPCh. 2 - Prob. 6CRPCh. 2 - Prob. 7CRPCh. 2 - Suppose a machine language is designed with an...Ch. 2 - Translate the following instructions from English...Ch. 2 - Rewrite the program in Figure 2.7 assuming that...Ch. 2 - Classify each of the following Vole instructions...Ch. 2 - Prob. 12CRPCh. 2 - Prob. 13CRPCh. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Prob. 18CRPCh. 2 - If the Vole executes an instruction every...Ch. 2 - Prob. 20CRPCh. 2 - Prob. 21CRPCh. 2 - Prob. 22CRPCh. 2 - Prob. 23CRPCh. 2 - Write a program in Vole to compute the sum of...Ch. 2 - Prob. 26CRPCh. 2 - Prob. 27CRPCh. 2 - Suppose the following program, written in Vole, is...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Suppose the registers 0x4 and 0x5 in the Vole...Ch. 2 - Prob. 33CRPCh. 2 - Prob. 34CRPCh. 2 - Prob. 35CRPCh. 2 - Prob. 36CRPCh. 2 - Prob. 37CRPCh. 2 - Prob. 38CRPCh. 2 - Prob. 39CRPCh. 2 - Prob. 40CRPCh. 2 - Prob. 41CRPCh. 2 - Prob. 42CRPCh. 2 - a. What single instruction in the Vole machine...Ch. 2 - Write a Vole program that reverses the contents of...Ch. 2 - Write a Vole program that subtracts the value...Ch. 2 - Prob. 46CRPCh. 2 - Suppose a person is typing forty words per minute...Ch. 2 - Prob. 48CRPCh. 2 - Suppose the Vole communicates with a printer using...Ch. 2 - Write a Vole program that places 0s in all the...Ch. 2 - Prob. 51CRPCh. 2 - Prob. 52CRPCh. 2 - Suppose you are given 32 processors, each capable...Ch. 2 - Prob. 54CRPCh. 2 - Prob. 55CRPCh. 2 - Describe how the average of a collection of...Ch. 2 - Write and test a Python script that reads in a...Ch. 2 - Write and test a Python script that reads in a...Ch. 2 - Prob. 59CRPCh. 2 - Suppose a computer manufacturer develops a new...Ch. 2 - Prob. 2SICh. 2 - Prob. 3SICh. 2 - Prob. 4SICh. 2 - Suppose a manufacturer produces a computer chip...Ch. 2 - Prob. 6SICh. 2 - Prob. 7SICh. 2 - Prob. 8SI
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a program to count blanks, tabs and newlines.
C Programming Language
What data structure does Python use in place of arrays?
Concepts of Programming Languages (11th Edition)
What is the purpose of testing a program with sample data or input?
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Code an SQL statement that creates a table with all columns from the parent and child tables in your answer to ...
Database Concepts (8th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Describe the primary differences between the conceptual and logical data models.
Modern Database Management (12th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- FizzBuzz Let’s play a game of FizzBuzz! It’s quite the same with your childhood “PopCorn” game, but with a little bit of twist to align it with programming. Input Format A line containing an integer. Input Sample 15 Output Format Multiple lines containing a string. Output Sample Fizz Buzz Fizz Fizz Buzz Fizz FizzBuzz Another test case: Input Sample 20 Output Sample Fizz Buzz Fizz Fizz Buzz Fizz FizzBuzz Fizz Buzz NOTE: Using for loop in C programming.arrow_forwardPython question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. Two words are anagrams if the letters of one can be rearranged to form the other. Forexample, mar, ram, and arm are all anagrams of each other. One way to quickly identifywhether two arbitrary words are anagrams are to sort the letters in each word to produce asignature. (The above words all have the signature 'amr'.) Two words are anagrams if andonly if they have the same signature. Write a function called anagrams() that takes thename of a text file as its only parameter. The file is assumed to have one word per line,all lower-case. The function returns a dictionary in which the keys are signatures ofwords in the file and the value for each key is the set of all words in the file having thatparticular signature.arrow_forwardAdd the purple code to your Main Code Section (type it by hand if you get weird errors – especially the spaces - since PowerPoint might use Unicode characters that Python don’t recognize): # ************************************************************************************************* # Main Code Section # ************************************************************************************************* # Create an object based on the PriceChecker class checkerObj = PriceChecker() # Load levelsList from the records in levelsFile checkerObj.readLevelsFromFile() # Display the levelsList and get user input for what actions to take userInput = 99 while userInput != 0: checkerObj.displayList() userInput = checkerObj.displayMenu() if(userInput == 1): checkerObj.addLevel() checkerObj.writeLevelsToFile() # Write levelsList to LevelsFile elif(userInput == 2): checkerObj.removeLevel()…arrow_forward
- b. You look through one classroom and you saw on the marker board math problems; 13 + 15 = 31. What number bases is the student using? Give one example of the number base problems. How many octal decimal positions would you need to display 65535? Swipe up for filters Add a caption.arrow_forwardA number is a palindrome if its reversal is the same as itself. An even palindrome number is a number which is even and also a palindrome. Write a program that displays the first 50 even palindrome numbers. Display 5 numbers per line and align the numbers properly.arrow_forwardPython question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. A single playing card can be represented by a string where the first character is a digit2-9 or a letter ‘A’, ‘T’, ‘J’, ‘Q’, or ‘K’, for Ace, Ten, Jack, Queen, King respectively, andthe second character is one of ‘S’, ‘H’, ‘D’, or ‘C’ for Spades, Hearts, Diamonds, orClubs. A hand of cards can be represented by a list of strings. Write a function calledthreeOfAKind() that takes a list of strings representing a hand of cards, and returns Trueif there are exactly three cards with the same value (regardless of suit), False otherwise.>>> threeOfAKind(['3D', 'KD', 'JD', '3H', '3S'])True>>> threeOfAKind(['3D', 'KD', 'JD', '3H', '4S', '5S'])False>>> threeOfAKind(['3D', '3H', '3S', '3C', 'AC'])Falsearrow_forward
- Adopt appropriate Java animation code to implement the video in the file "test3.wmv" and given that the parametric equation for a circle: x=r*cos(t) y=r* sin(t) with t in range [0, 2π] and r is the radius of the circle.arrow_forwardUsing java script Print a string vertically. Ask the user for a string (allow spaces to be part of the string). Print the string one letter per line.arrow_forwardYou're interested in looking at trending Twitter hashtags, but you notice that people aren't very consistent with how they use them. Specifically, the capitalisation and punctuation in hashtags is inconsistent. You decide to write a program to read in tweets, normalise any hashtags present, and print out a tally of frequencies. Hashtags should only include words starting with #. All punctuation should be removed from the end of a hashtag, and the letters should be converted to lowercase. For instance, #Python! should be normalised to #python, and #Today_I_Learned... should be #today_i_learned. Your program should work like this. The tally of hashtags can be printed out in any order. Tweet: #Python is #AWESOME!Tweet: This is #So_much_fun #awesomeTweet: #python 1#awesome 2#so_much_fun 1arrow_forward
- Write a program that prints a custom conversion table from Celsius temperatures to Fahrenheit and Newton (Links to an external site.) temperatures. The formula for the conversion from Celsius to Fahrenheit is : F=9/5*C+32 F is the Fahrenheit temperature, and C is the Celsius temperature. The formula for the conversion from Celsius to Newton is C = 100/33*N N is the Newton Temperature and C is the Celsius temperature Your program should prompt the user for a lower value and upper value for a range of temperatures in Celsius. It should then prompt the user for the amount they want to increment by. Then use a loop to output to a file named conversion_table.txt a table of the Celsius temperatures and their Fahrenheit and Newton equivalents within the range of values using the increment given by the user. Make sure to format your output to 2 decimal places. INPUT VALIDATION: Ensure the second number is greater than the first number, and make sure the increment is greater than 0.arrow_forwardWrite a Javascript program find the sum of natural numbers from n = 11 to m = 111. Also display the sum in the output.arrow_forwardcalculates and prints the area of the rectangle to 2 decimal places. See the examples below for the exact expected behaviour. Notes: • The input prompt strings end with the symbol = followed by a space. • In the examples below, the Input column shows you the user input for each line (i.e., what you will type on the keyboard when testing your code). For example, in line 1 of the Result column, everything before the 10.123 is the prompt for the input. • If you can't remember how to format to 2 decimal places, you might like to re- watch the Formatting output video or review the f-string quick guide. For example: Test get_and_print_rectangle() get_and_print_rectangle() 1.0 1.0 get_and_print_rectangle() 0.17 100 Answer: (penalty regime: 0 %) Reset answer Input Result 10.123 Rectangle width = 10.123 20.234 Rectangle height = 20.234 |||||| Scratchpad The area of the rectangle is 204.83 Rectangle width = 1.0 Rectangle height = 1.0 The area of the rectangle is 1.00 1 def…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY