Computer Science: An Overview (12th Edition)
12th Edition
ISBN: 9780133760064
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 12, Problem 8CRP
Write a Bare Bones
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
write a program in python language:
You are given a rectangular board of Mx N
squares. Also you are given an unlimited number
of standard domino pieces of 2 x1 squares. You
are allowed to rotate the pieces. You are asked to
place as many dominoes as possible on the board
so as to meet the following conditions:
1. Each domino completely covers two squares.
2. No two dominoes overlap.
3. Each domino lies entirely inside the board. It is
allowed to touch the edges of the board.
Find the maximum number of dominoes, which
can be placed under these restrictions.
ex:
24
4
Write a program that reads an integer and displays all its smallest factors in an increasing order. For example, if the input integer is 120, the output should be as follows: 2, 2, 2, 3, 5.
In C++
Chapter 12 Solutions
Computer Science: An Overview (12th Edition)
Ch. 12.1 - Prob. 1QECh. 12.1 - Prob. 2QECh. 12.1 - Prob. 3QECh. 12.1 - Prob. 4QECh. 12.2 - Prob. 1QECh. 12.2 - Prob. 2QECh. 12.2 - Prob. 3QECh. 12.2 - Prob. 4QECh. 12.2 - Prob. 5QECh. 12.3 - Prob. 1QE
Ch. 12.3 - Prob. 3QECh. 12.3 - Prob. 5QECh. 12.3 - Prob. 6QECh. 12.4 - Prob. 1QECh. 12.4 - Prob. 2QECh. 12.4 - Prob. 3QECh. 12.5 - Prob. 1QECh. 12.5 - Prob. 2QECh. 12.5 - Prob. 4QECh. 12.5 - Prob. 5QECh. 12.6 - Prob. 1QECh. 12.6 - Prob. 2QECh. 12.6 - Prob. 3QECh. 12.6 - Prob. 4QECh. 12 - Prob. 1CRPCh. 12 - Prob. 2CRPCh. 12 - Prob. 3CRPCh. 12 - In each of the following cases, write a program...Ch. 12 - Prob. 5CRPCh. 12 - Describe the function computed by the following...Ch. 12 - Describe the function computed by the following...Ch. 12 - Write a Bare Bones program that computes the...Ch. 12 - Prob. 9CRPCh. 12 - In this chapter we saw how the statement copy...Ch. 12 - Prob. 11CRPCh. 12 - Prob. 12CRPCh. 12 - Prob. 13CRPCh. 12 - Prob. 14CRPCh. 12 - Prob. 15CRPCh. 12 - Prob. 16CRPCh. 12 - Prob. 17CRPCh. 12 - Prob. 18CRPCh. 12 - Prob. 19CRPCh. 12 - Analyze the validity of the following pair of...Ch. 12 - Analyze the validity of the statement The cook on...Ch. 12 - Suppose you were in a country where each person...Ch. 12 - Prob. 23CRPCh. 12 - Prob. 24CRPCh. 12 - Suppose you needed to find out if anyone in a...Ch. 12 - Prob. 26CRPCh. 12 - Prob. 27CRPCh. 12 - Prob. 28CRPCh. 12 - Prob. 29CRPCh. 12 - Prob. 30CRPCh. 12 - Prob. 31CRPCh. 12 - Suppose a lottery is based on correctly picking...Ch. 12 - Is the following algorithm deterministic? Explain...Ch. 12 - Prob. 34CRPCh. 12 - Prob. 35CRPCh. 12 - Does the following algorithm have a polynomial or...Ch. 12 - Prob. 37CRPCh. 12 - Summarize the distinction between stating that a...Ch. 12 - Prob. 39CRPCh. 12 - Prob. 40CRPCh. 12 - Prob. 41CRPCh. 12 - Prob. 42CRPCh. 12 - Prob. 43CRPCh. 12 - Prob. 44CRPCh. 12 - Prob. 46CRPCh. 12 - Prob. 48CRPCh. 12 - Prob. 49CRPCh. 12 - Prob. 50CRPCh. 12 - Prob. 51CRPCh. 12 - Prob. 52CRPCh. 12 - Prob. 1SICh. 12 - Prob. 2SICh. 12 - Prob. 3SICh. 12 - Prob. 4SICh. 12 - Prob. 5SICh. 12 - Prob. 6SICh. 12 - Prob. 7SICh. 12 - Prob. 8SI
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
- Write a program that reads two points on a line, calculates the slope, and determines whether the slope is positive, negative, zero, or undefined. Run your program for the following pairs of points: a. (-2, 1) and (2, 3) b. (4,1) and (4,3)arrow_forwardUse python The speeding ticket fine policy in Wonderland-Bemidji is $50 plus $5 for each mph over the limit, plus an additional penalty of $200 for any speeds over 90mph. Write a program that accepts a speed limit (<= 90) and a clocked speed, and either outputs a message indicating the speed was legal, or prints the amount of the fine if the speed is illegal.arrow_forwardWrite a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base: a Height of the pyramid: h Volume = a2h/3 Slant height, s = sqrt(h2 + (a/2)2) This is the Pythagorean Theorem part. Area of one pyramid side = s*a/2 For this program you are to determine two things about a square pyramid. 1) the surface area of the four sides. 2) the volume. Do not include surface area of the base. Test case 1: Height: 5.0' Base: 2.5' Test case 2: Height 2.5 Base: 4.3' The program asks the user to enter the pyramid height (in feet) and length of the base (in feet). Your program will need to determine surface area, and volume by using pythagorean theorem. Your output should neatly show the height, base, total surface area, and volume of the pyramid using 33 decimal place of…arrow_forward
- Write a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base: a Height of the pyramid: h Volume = a2h/3 Slant height, s = sqrt(h2 + (a/2)2) This is the Pythagorean Theorem part. Area of one pyramid side = s*a/2 Here are my calculations: Test Case #1 Height(h): 5.0’ Base(a): 2.5’ Volume = (2.5**2) * (5/3) (6.25) * (1.66) = 10.375 cubic feet Slant Height = math.sqrt(5**2) + (2.5/2)**2) Sqrt(25+1.5625) Sqrt(26.5625) = 5.154 feet Pyramid (not including base) = (5.154) * (2.5/2) * 4 (5.154) * (1.25) * (4) = 25.769 sq. Ft. I have attached a screenshot of my program I have so far. When I run the program, the output doesn't match what I have for the surface area and volume, am I missing something?arrow_forwardWrite a program which can be used to calculate bonus points to given scores in the range [1..9] according to the following rules: If the score is between 1 and 3, the bonus points is the score multiplied by 10 If the score is between 4 and 6, the bonus points is the score multiplied by 100 If the score is between 7 and 9, the bonus points is the score multiplied by 1000 For invalid scores there are no bonus points (0) Your program must make use of 2 parallel arrays - one to store the scores and the other to store the bonus points. You need to make provision for 5 scores (and bonus points) that will need to be stored. For this program implement the following methods and use these methods in your solution (do not change the method declarations): static void getScores(int[] scores) \\ gets the required scores from the user - no checking for valid entries \\ you may assume valid values static void calc Bonus(int[] scores, int[] bonusPoints) \\ calculates the bonus points and stores them in…arrow_forwardWrite a c++ program to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows: 1 A B C D 2 A B C D 3 A B C D 4 A B C D 5 A B C D 6 A B C D 7 A B C D The program should display the seat pattern, with an 'X' marking the seats already assigned. For example, after seats 1A, 2B, and 4C are taken, the display should look like this: 1 X B C D 2 A X C D 3 A B C D 4 A B X D 5 A B C D 6 A B C D 7 A B C D After displaying the seats available, the program prompts for the seat desired, the user types in a seat, and then the display of available seats is updated. This continues until all seats are filled or until the user signals that the program should end. If the user types in a seat that is already assigned, the program should say that that seat is occupied and ask…arrow_forward
- Use the cubicSpline module to write programs that interpolate between a given data point with a cubic spline. The program must be able to evaluate the interpolant for more than one x value. As a test, use the data points specified in the previous Example and calculate the interpolants at x = 1.5 and x = 4.5 (due to symmetry, these values must be the same) import numpy as np from cubicSpline import * xData = np.array([1,2,3,4,5], float) yData = np.array([0,1,0,1,0], float) k = curvatures (xData, yData) while True: try: x = eval(input("\nx ==> ")) except SyntaxError: break print("y=", evalSpline (xData, yData, k, x)) input ("Done. Press return to exit") Exercise Fix the Cubic Spline Program There is an error in the Cubic Spline program, fix it and evaluate the values of x 1/2 = 1.5 and x = 4.5, where the results of both values must be the same.arrow_forwardC PROGRAM Write a program that loops from 0 to N (exclusive) given an inputted integer N. However, you need to print the numbers from 0 to N in this pattern: even, even, odd, odd, even, even, odd, odd,.... SAMPLE: Input N: 15 Output: 0 2 3 5 6 8 9 11 12 14 Input N: 10 Output: 0 2 3 5 6 8 9arrow_forwardWrite pseudocode for an automatic hand sanitizer that displays green LED when the hand sanitizer solution is full, otherwise displays red LED when the hand sanitizer solution is near end. It also keeps check of how much hand sanitizer solution is pumped e.g. total is 500 ml, so each pump of hand sanitizer solution is 0.5 ml which is when it checks each pump using Infrared sensor.arrow_forward
- Python For this lab, you will use a tuple to represent a student record. A student record consists of the student’s name, year, and GPA. For example, (“John”, “Senior”, 3.7) is a record for John who is a senior with a 3.7 GPA. You will write a program that prompts the user for the number of records to enter. Then it reads input from the user for each record. Remember that each record consists of a student’s name, year, and GPA. It then prints the record of each student as shown below. Functions: You will write the following functions: read_records(n) Read n number of records and return a list of records. print_records(records) Takes in a list of records and print each one. main() Prompts the user for the number of records to read, get a list of records from the user, and print the records. Optional: print the average GPA of the students. Sample run: How many students record to enter: 2 Enter student's name: John Enter student's year: junior Enter…arrow_forwardWrite a program that takes a positive integer x greater than zero typed in by the user, and prints the count from x to x+9 (including this one) using printf with newline after each printed value. Example: if x=1, the program should print:arrow_forward(Program) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters, such as zerocount, onecount, twocount, and so forth, to 0. Then generate a large number of pseudorandom integers between 0 and 9. Each time 0 occurs, increment zerocount; when 1 occurs, increment onecount; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of time they occurred.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Binary Numbers and Base Systems as Fast as Possible; Author: Techquikie;https://www.youtube.com/watch?v=LpuPe81bc2w;License: Standard YouTube License, CC-BY
Binary Number System; Author: Neso Academy;https://www.youtube.com/watch?v=w7ZLvYAi6pY;License: Standard Youtube License