Can you write a code for this problem? When a car breaks, it is sent to the car repair shop, which is capable of repairing at most CountPerDay cars per day. Given a record of the number of cars that arrive at the shop each morning, your task is to determine how many days the shop must operate to repair all the cars, not counting any days the shop spends entirely workless. For example, suppose the shop is capable of repairing at most 8 cars per day, and over a stretch of 5 days, it receives 10, 0, 0, 4, and 20 cars, respectively. The shop would operate on days 1 and 2, sit idle on day 3, and operate again on days 4 through 7. In total, the shop would operate for 6 days to repair all the cars. Write a class CarRepairs containing a method GetDays that takes a sequence of In-coming counts InComing(of type int[]) and an int CountPerDay, and calculates the number of days of operation. Definition Class: CarRepairs Method: GetDays Parameters: int[], int Method signature: int GetDays (int[] InComing, int CountPerDay ) Returns: int Conditions: -InComing contains between 1 and 20 elements, inclusive. -Each element of InComingis between 0 and 100, inclusive. -CountPerDay is between 1 and 50, inclusive.
donald_duck · Feb 8, 2012 1:19 PM · 2,300 views
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion