My program is running fine until the very end where I need the time. My professor wants the time to be in hours and minutes (ex: 4 hours and 15 minutes). When my program gets to the time part I get really big numbers and negative numbers... Please help!
Sorry, I thought putting the code into [code] brackets would let me run the online compiler. Guess not. Could you post some example numbers that you've put in for the widths, lengths, etc.?
What you need to do is write down a few test samples. Work out the test results manually and compare to the values generated by your program. Show us the output.
minutes = time % 60; --- time is double, minutes is int, % is integer division
250, 150, 75, 40, 12, 50, 10. Those are my input numbers and my output I get for my total area is 33821.46, and then that should be divided by 200 to get my minutes (200 sqft covered each minute). My hour output and minutes output are end up being very large numbers like 79384340 and also sometimes negative numbers.
I'm not sure if this will change anything, but hours and minutes should both be integer values. The reason for this is that since you are giving the amount of minutes, there's no reason to have a non-whole number of hours. The reason minutes should be integer is that modular arithmetic always returns an integer value. So if timeoutput = 169.105 (using the area you've given), then hours should equal 2. If timeoutput = 169.105, time = 169, so minutes = 169%60 should give 49. The output should then say that the lawn took 2 hours and 49 minutes to mow.