[Show all top banners]

donald_duck

More by donald_duck
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Problem for programmers
[VIEWED 1762 TIMES]
SAVE! for ease of future access.
Posted on 02-08-12 1:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 


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.


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 90 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Nas and The Bokas: Coming to a Night Club near you
Will MAGA really start shooting people?
Democrats are so sure Trump will win
मन भित्र को पत्रै पत्र!
Top 10 Anti-vaxxers Who Got Owned by COVID
TPS Work Permit/How long your took?
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
Breathe in. Breathe out.
3 most corrupt politicians in the world
Dementia Joe has been selected to become the next President
Trumpism project 2025 everyone should read https://www.project2025.org/
आज बाट तिहारको सेल सकियो
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Nas and The Bokas: Coming to a Night Club near you
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters