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)
- do it fastarrow_forwardThe Harris-Benedict equation estimates the number of calories your body needs to maintainyour weight if you do no exercise. This is called your basal metabolic rate, or BMR.The formula for the calories needed for a woman to maintain her weight isBMR = 655 + (4.3 x weight in pounds) + (4.7 x height in inches) -(4.7 x age in years)The formula for the calories needed for a man to maintain his weight isBMR = 66 + (6.3 x weight in pounds) + (12.9 x height in inches) -(6.8 x age in years)A typical chocolate bar will contain around 230 calories. Write a program that allows the userto input his or her weight in pounds, height in inches, age in years, and the character M formale and F for female. The program should then output the number of chocolate bars thatshould be consumed to maintain one's weight for the appropriate sex of the specified weight,height, and age.arrow_forwardHello, I was wondering if I could get help with this. The language I am using is Pythonarrow_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_forwardusing python language (please refer to the image)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_forward
- Instructions A local biologist needs a program to predict population growth. The inputs would be: 1. The initial number of organisms, as an int 2. The rate of growth (a real number greater than 1), as a float 3. The number of hours it takes to achieve this rate, as an int 4. A number of hours during which the population grows, as an int For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms. Write a program that takes these inputs and displays a prediction of the total population. An example of the program input and output is shown below: Enter the initial number of organisms: 10 Enter the rate of growth (a real number › 1]: 2 Enter the number of hours to achieve the…arrow_forwardA teacher at Leva Primary School needs to divide her class in different group sizes according to the activity they have to do. This will help her to prepare workstations for each group. For example, for art projects the class has to be divided in groups of 6; for science projects the class has to be divided in groups of 4. She asked you to write a program to determine the number of groups as well as the number of pupils who are left to form a smaller group. There are 56 pupils in the class.The program has the following structure:• Declare three int variables nrPupils, nrGroups, and nrLeft. nrPupils represents the number of pupils in a class, nrGroups represents the number of groups the class is divided into, and nrLeft represents the number of pupils, if any, who are in the remaining smaller group.• Assign the value 56 to nrPupils.• Declare an int variable groupSize that is used by a cin statement to input a value from the keyboard and store the size of the groups the teacher…arrow_forwardplease use pseudocode to answer the following question Two students challenge each other to a basketball shootout. They agree to limit the number of attempts to 3 throws each. The game will be constructed in two sessions where the first student will make all 3 attempts followed by the second student. The student who makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie, the game will be repeated until a winner can be determined.arrow_forward
- Write a python code that does the following: - Asks student to enter his name - Ask them to enter their marks for 4 different modules. (Note: these marks should be out of 100 for each module) - Based on the average of the 4 different modules, the student should get the grade that they have achieved at that level. - The grades should follow the following trend - greater than or equal to 90 = A - from 80 to 89 inclusive = B - from 70 to 79 inclusive = C - from 60 to 69 inclusive = D - from 50 to 59 inclusive = E - below 50 = Farrow_forwardpython solution please Task 1Description let's consider a case when you need a lot of coffee. Maybe you're hosting a party with a lot of guests! In these circumstances, it's better to make preparations in advance.So, we will ask a user to enter the desired amount of coffee, in cups. Given this, you can adjust the program by calculating how much water, coffee, and milk are necessary to make the specified amount of coffee.Of course, all this coffee is not needed right now, so at this stage, the coffee machine doesn't actually make any coffee yet. ObjectivesLet's break the task into several steps:First, read the numbers of coffee drinks from the input.Figure out how much of each ingredient the machine will need. Note that one cup of coffee made on this coffee machine contains 200 ml of water, 50 ml of milk, and 15 g of coffee beans.Output the required ingredient amounts back to the user. ExamplesThe greater-than symbol followed by space (> ) represents the user input. Notice that…arrow_forwardCorrect and detailed answer please. Thank you!arrow_forward
- 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 PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,