Hey guys,
I am getting back into coding, I have done up a console app that calculates hours/minutes between a start and finish time depending on how many people are 'working' between the start and finish time. I have completed about 90% of it but I am now stuck.
App in summary:
input from user:
1. Start Time
2. Finish Time
3. People working between start and finish time
Code:
Splits the 24 hour start and finish time into two integers for hours and minutes (e.g. Start time 2130, int starthour 21 and int startMin 30 etc)
code calculates hours and minutes divided by people working.
Output:
"Total time from start to finish is x hours and y minutes."
"That's z minutes per person"
The above is all well and good, now this is where I am stuck, my intent is to have the following output, as an example, 3 people working over 2 hours:
Person 1 will work from 1900 until 1940
Person 2 will work from 1940 until 2020
Person 3 will work from 2020 until 2100 |
I have no idea how to implement this, do I create a loop so that when the minutes integer is >= 60 it resets to 0 and ++hour, how would I do this? then how do I implement a switch case (if I need one?) that uses the above info reference timings and spews it out dependent on how many people are working? E.g. case 1 for one person working, case 2 for 2 people working etc.
I hope I have explained this in a clear manner for you guys, any help would be great.
Kind Regards, Ryan