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
Modern Database Management
Absolute Java (6th Edition)
C How to Program (8th Edition)
Database Concepts (8th Edition)
Starting Out With Visual Basic (7th Edition)
Software Engineering (10th Edition)
- Writing 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_forwardusing python Write a wholly creative quiz program that consists of three original questions that you make up according to these specifications: One question should require user input of type int One question should require user input of type float One should require a string input The quiz should be scored by using a counter variable that has an initial value of zero and is incremented by one for every correct answer. Provide feedbackto the user for each question, and report the total score when the quiz has finished. Example runs not shown. It's a creative exercise.arrow_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_forward
- Using python language, make a unit conversion program that computes and shows the three types of conversion (Ex. 12 inches = (1) foot/feet, (30.48) centimeters, (304.8) millimeters). You can only use the aforementioned measurements (length, weight, speed, or time).The unit conversion program allows the user to input a chosen conversion and repeats the program until the word "stop" is typed. A message is shown after converting the value.arrow_forwardAssuming there are no accidents or delays, the distance that a car travels down the interstate canbe calculated with the following formula:Distance=Speed×TimeA car is traveling at 70 miles per hour. Write a program that displays the following:The distance the car will travel in 6 hoursThe distance the car will travel in 10 hoursThe distance the car will travel in 15 hoursarrow_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_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_forwardYour relative, who goes to primary school and has just learned the multiplication table, asks you to constantly ask him. You wanted to gamify it. The computer will randomly scan in the multiplication table and the user will write the answer on the screen. There will be 10 questions in total and at the end the number of questions, the number of correct answers and the number of wrong answers will be printed on the screen. Also, write a program that will print if the percentage of success is below 80, it remained, and if it was above, it passed. (On C# ConsoleApp(.Net Framework)arrow_forward
- In 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_forwardWrite 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_forwardYou can approximate e using the following summation: Write a program that displays the e value for i = 10000, 20000, …, and 100000.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning