questiongiven a series of numbers that represent


Question

Given a series of numbers that represent adding fuel (2) and subtracting fuel (1), determine highest distance that is travelled before running out of fuel.

1. Your vehicle will always begin on right side with no fuel.

2. You could advance to the first 2 digit (from the right) as a starting point and from where you are able to travel two spaces (to the left).

3. Each time your vehicle crosses another 2 the fuel tank is filled

4. Each time your vehicle crosses a 1 your fuel tank decreases by 1.

5. Your vehicle comes to a stop as it has no fuel and while the next digit to the left of its current position is a 1.

Input Validation-

1. Your program has to reject all negative input and all input that contains digits other than 1s and 2s.

2. The user has to be given an unlimited number of opportunities to enter valid data as input.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questiongiven a series of numbers that represent
Reference No:- TGS0445009

Expected delivery within 24 Hours