C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Python matplotlib or seaborn)
CPU Usage
We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight.
Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart:
When does the worker typically take lunch?
Did the worker do work on the weekend?
On which weekday did the worker start working on their computer at the latest hour?
cpu_usage = [
[2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23,
45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday
[1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44,
33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday
[2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31,
54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday
[1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18,
41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday
[4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27,
43, 8,…
1) Simple Calculator: In Python, implement a simple calculator that does the following
operations: summation, subtraction, multiplication, division, sqrt, power, natural log and abs.
a) Follow the instructions below:
To work with the calculator, the user is asked to enter the first number, then the
operation, and finally, a second number if required.
Your code has to recognize the need for the second number and ask for it if required.
After performing one operation, the calculator prints the output of the operation.
After performing one operation, the calculator must not exit. It has to start again for
the next operation.
The calculator will be closed if the user writes 'e' as any input.
Use functions to perform the operations and the appropriate conditions to prevent
common errors such as entering characters as one of the numbers etc.
b) Run your code and provide the results for at least one example per operation.
-
-
PROBLEM: Repetition Control Structure (while, do-while)
SHOW THE CODES IN ANY JAVA APPLICATION LIKE JCRATOR AND ECLIPSE. OUTPUT SHOULD BE LIKE IN THE TABLE.
Chapter 6 Solutions
C++ How to Program (10th Edition)
Ch. 6 - Show the value of x after each of the following...Ch. 6 - (Parking Charges) A parking garage charges a...Ch. 6 - Prob. 6.13ECh. 6 - (Rounding Numbers) Function floor can be used to...Ch. 6 - Prob. 6.15ECh. 6 - (Random Numbers) Write statement that assign...Ch. 6 - (Random Numbers) Write a single statement that...Ch. 6 - Prob. 6.18ECh. 6 - Prob. 6.19ECh. 6 - Prob. 6.20E
Ch. 6 - Prob. 6.21ECh. 6 - Prob. 6.22ECh. 6 - Prob. 6.23ECh. 6 - (Separating Digits) Write program segments that...Ch. 6 - (Calculating Number of Seconds) Write a function...Ch. 6 - (Celsius and Fahrenheit Temperature) Implement the...Ch. 6 - (Find the Minimum) Write a program that inputs...Ch. 6 - Prob. 6.28ECh. 6 - (Prime Numbers) An integer is said to be prime if...Ch. 6 - Prob. 6.30ECh. 6 - Prob. 6.31ECh. 6 - (Quality Points for Numeric Grades) Write a...Ch. 6 - Prob. 6.33ECh. 6 - (Guess-the-Number Game) Write a program that plays...Ch. 6 - (Guess-the-Number Game Modification) Modify the...Ch. 6 - Prob. 6.36ECh. 6 - Prob. 6.37ECh. 6 - Prob. 6.38ECh. 6 - Prob. 6.39ECh. 6 - Prob. 6.40ECh. 6 - Prob. 6.41ECh. 6 - Prob. 6.42ECh. 6 - Prob. 6.43ECh. 6 - Prob. 6.44ECh. 6 - (Math Library Functions) Write a program that...Ch. 6 - (Find the Error) Find the error in each of the...Ch. 6 - (Craps Game Modification) Modify the craps program...Ch. 6 - (Circle Area) Write a C++ program that prompts the...Ch. 6 - (pass-by-Value vs. Pass-by-Reference) Write a...Ch. 6 - (Unary Scope Resolution Operator) What’s the...Ch. 6 - (Function Templateminimum) Write a program that...Ch. 6 - Prob. 6.52ECh. 6 - (Find the Error) Determine whether the following...Ch. 6 - (C++ Random Numbers: Modified Craps Game) Modify...Ch. 6 - (C++ Scoped enum) Create a scoped enum named...Ch. 6 - (Function Prototype and Definitions) Explain the...Ch. 6 - Prob. 6.57MADCh. 6 - Prob. 6.58MADCh. 6 - (Computer-Assisted Instruction: Monitoring Student...Ch. 6 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 6 - (Computer-Assisted Instruction: Varying the Types...
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
- (Q1)This is a Data Structures problem and the programming language used is Lisp. Solve the question we detailed steps and make it concise and easy to understand. Please and thank you.arrow_forwardC Programming Language (Code With C Programming Language) Problem Title : Visible Trees There is a legend about a magical park with N × N trees. The trees are positioned in a square grid with N rows (numbered from 1 to N from north to south) and N columns (numbered from 1 to N from west to east). The height (in metres) of each tree is an integer between 1 and N × N, inclusive. Magically, the height of all trees is unique. Bunga is standing on the northmost point of the park and wants to count the number of visible trees for each Column. Similarly, Lestari is standing on the westmost point of the park and wants to count the number of visible trees for each Row. A tree X is visible if all other trees in front of the tree X are shorter than the tree X. For example, let N = 3 and the height (in metres) of the trees are as follows6 1 87 5 32 9 4 On the first column, Bunga can see two trees, as the tree on the third row is obstructed by the other trees. On the second column, Bunga can see…arrow_forwardLanguage: JAVA Leap-Year Write a program to find if a year is a leap year or not. We generally assume that if a year number is divisible by 4 it is a leap year. But it is not the only case. A year is a leap year if − It is evenly divisible by 100 If it is divisible by 100, then it should also be divisible by 400 Except this, all other years evenly divisible by 4 are leap years. So the leap year algorithm is, given the year number Y, Check if Y is divisible by 4 but not 100, DISPLAY "leap year" Check if Y is divisible by 400, DISPLAY "leap year" Otherwise, DISPLAY "not leap year" For this program you have to take the input, that is the year number from an input file input.txt that is provided to you. The input file contains multiple input year numbers. Use a while loop to input the year numbers from the input file one at a time and check if that year is a leap year or not. Create a class named LeapYear which will contain the main method and write all your code in the main…arrow_forward
- Exercise 1: (Design of algorithm to find greatest common divisor) In mathematics, the greatest common divisor (gcd) of two or more integers is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4. Why? Divisors of 8 are 1, 2, 4, 8. Divisors of 12 are 1, 2, 4, 6, 12 Thus, the common divisors of 8 and 12 are 1, 2, 4. Out of these common divisors, the greatest one is 4. Therefore, the greatest common divisor (gcd) of 8 and 12 is 4. Write a programming code for a function FindGCD(m,n) that find the greatest common divisor. You can use any language of Java/C++/Python/Octave. Find GCD Algorithm: Step 1 Make an array to store common divisors of two integers m, n. Step 2 Check all the integers from 1 to minimun(m,n) whether they divide both m, n. If yes, add it to the array. Step 3 Return the maximum number in the array.arrow_forwardProblem Description: The bird of paradise called the Helipixsal is renowned for its magnificent tail feathers which range in number from five to nine ornate feathers each of a different length. Their "magnificence" is quantified by the rather simple process of counting the exact number of tail feathers and multiplying this by the difference in the length of the minimum and maximum lengths of tail feather. You are to write a simple program that will allow the user to enter the length of each tail feather individually and keep on entering feathers until a -1 is entered. The program will then return the quantified "magnificence" factor.arrow_forward9: perfect.cpp) A number is called perfect if the sum of its divisors is equal to the original number. A number is called deficient if the sum of its divisors is less than the original number. A number is called abundant if the sum of its divisors is more than the original number. Write a program that answers the following questions: What numbers below 5000 are perfect? What odd numbers below 5000 are abundant? What are the relative proportions of deficient, abundant, and perfect numbers? 5000 should be in a global constant.arrow_forward
- (Conversion) a. Write a C++ program to convert meters to feet. The program should request the starting meter value, the number of conversions to be made, and the increment between metric values. The display should have appropriate headings and list the meters and the corresponding feet value. If the number of iterations is greater than 10, have your program substitute a default increment of 10. Use the relationship that 1 meter = 3.281 feet. b. Run the program written in Exercise 6a on a computer. Verify that your program begins at the correct starting meter value and contains the exact number of conversions specified in your input data. c. Modify the program written in Exercise 6a to request the starting meter value, the ending meter value, and the increment. Instead of the condition checking for a fixed count, the condition checks for the ending meter value. If the number of iterations is greater than 20, have your program substitute a default increment of (ending value - starting value) / 19.arrow_forward15. Write a program to implement and test the algorithm that you designed for Exercise 15 of Chapter 1. (You may assume that the value of . In your program, declare a named constant PI to store this value.)arrow_forwardC language programarrow_forward
- Python 6. Sum of Numbers Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, ...50. Use recursion to calculate • the sum.arrow_forwardPlease help answer these two questions in Python. (See attached image) Attach screenshots of your code for clarity.arrow_forwardProblem B Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author: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
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License