Concept explainers
Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a
Write a function that takes as input a start time and an end time represented as an int, using military notation. The function should return the difference in minutes as an integer. Write a driver program that calls your subroutine with times entered by the user.
Hint: Be careful of time intervals that start before midnight and end the following day.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Absolute C++
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
SURVEY OF OPERATING SYSTEMS
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- please use pythonarrow_forwardWriting a Machine Language Program Write a TOY machine language program which calculates x3 by using repeated addition, where x is input by the user. This program has to work for positive integers only, and you can assume that is what will be entered as input. The flow of action must loop within the code. Your program should output the running total while it calculates it to Stdout. Notes: You will need to create your program using the Visual X-TOY simulator. Make sure that your program code begins at address 10. Run it, test it, then save it as a .toy file. For this question you must submit your program as a .toy file. Handwritten documents or other formats will not be accepted. You do not need to add any code comments of your own. A few common questions have popped up about assignment 5. So here are a few hints: To use the TOY simulator, first install Java JRE from here: https://www.java.com/en/download/manual.jsp. Make sure to select the download for your OS and…arrow_forwarddo it fastarrow_forward
- Hello, I was wondering if I could get help with this. The language I am using is Pythonarrow_forward4. Write a Phyton program that computes the speed of sound (a) in air of a given temperature T (°F ). Use the formula 5T+2297 2457 a = 10861arrow_forwardWritten In Python The amount of time students spent studying for an test is exponentially distributed with a mean of 25 hours. Write a piece of code to compute the percentage of students who spent between 30 and 40 hours studying for the test? Your code should print out the percentage rounded to 1 decimal place.arrow_forward
- Need this written in the PYTHON language. Step 1: Ask the user to enter the length of their room (in feet). Step 2: Ask the user to enter the width of their room (in feet). Step 3: Calculate the area (in square feet) of the room by multiplying the length and the width of the room. For example, if a room is 20 feet wide by 24 feet long, then its area is 20 * 24 = 480 square feet Step 4: Display a menu that asks the user how much shade the room gets. The menu should have the following options: Little Shade Moderate Shade Abundant Shade Step 5: Determine the capacity of the air conditioning unit that is needed for a moderately shaded room by using the information in the table below. Room Size (sq. ft) AC capacity (BTUs/hr) Less than 250 5,500 250 to 500 10,000 501 to 1,000 17,500 Over 1,000 24,000 If the room has little shade, then the BTU capacity should be increased by 15% since the air conditioning unit must be able to produce extra…arrow_forwardIn this task, you are required to write a code which takes as an input an angle [0°, 90°] in radians and returns the approximate value of the cosine of this angle. The code will also take as an input the number of terms to be used to approximate the result. We will use the Maclaurin series of cos(x) to approximate the result. The series is given by: cos(x) -1"x2 Ln =0 (2n!) but for practical reasons, we will not use infinite terms but k terms where k is input by the user: cos(x) = -1"2 Ln =0 (2n!) So, for example, to calculate the cosine for 60° (1.04667 radians) using five terms, the approximation will be: 1- 1.04667? 2! 1.04667 8! 1.046674 1.04667 = 0.50046 4! 6! • The program should at most handle 15 terms (to avoid overflows due to factorial), otherwise the program outputs Invalid • There should be at least three terms used in the approximation, otherwise the program outputs Invalid • If the number of terms is negative, the programs corrects it automatically to positive. I/0…arrow_forwardAn instructor gives a series of exams during the semester in her math class. At the end of the semester she drops each student's lowest test score before averaging the scores. She has asked you to design a program that will read a student's test scores as input and calculate the average with the lowest score dropped. Here is the algorithm that you developed: Get the student's test scores. Calculate the total of the scores. Find the lowest score. Subtract the lowest score from the total. This gives the adjusted total. Divide the adjusted total by 1 less than the number of test scores. This is the adjusted average. Display the average. The test scores are in a text file named scores.txt and contains the following: Mickey, 71.0, 42.0, 83.0 Donald, 94.0, 73.0, 72.0, 81.0 Minnie, 95.0, 85.0, 45.0, 55.0, 65.0 A sample run is as follows: Enter a file containing floating point numbers: scores.txt Test scores for Mickey: ['71.0', '42.0', '83.0'] Removed the lowest score of 42.0 for Mickey The…arrow_forward
- Write a Python code This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator. The program is as follows: Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days. The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents). The output of the program should include the total number of bottles returned and the total paid out. The program will ask the user if they have more data to enter and will end the program if they do not. Step 1: In the pseudocode below, declare the following variables under the documentation for Step 1. A variable called totalBottles that is initialized to 0 This variable will store the accumulated bottle values A variable called counter and that is initialized to 1 This variable will control the loop A variable called todayBottles…arrow_forwardEasy Pyhthon Program Please Answer Fast:arrow_forwardA parking garage charges a $2.00 minimum fee to park for up to three hours and an additional $1 per hour for each hour or part thereof over four hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculate Charges to determine the charge for each customer.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning