about | help | code help+videos | done | prefs |
For this problem, you may only use the following string methods: .length .substring .charAt .equals You may use any non-string stuff that you want to use, including Interget.parseInt. Write a method that calculates the "virtual length" of a run of pipe for a pool circulation system. The virtual length is the sum of all the lengths of pipe plus 6 "virtual feet" of pipe added for 90 degree bends and 2 "virtual feet" added for 45 degree bends. For example, a run of 10 feet followed by a 90 degree elbow, followed by 2 feet of pipe counts as 18 feet of pipe (10 real feet plus 6 virtual feet plus 2 real feet). Look at the test data for further examples. The array will start and end with straight feet of pipe. Fittings (90 degree and 45 degree only) and lengths of pipe can appear in any order in the middle. Look at the test data for examples of this also. sunFunPoolPumpPipe(["45 ft", "90 ft", "45 dg"]) → 137 sunFunPoolPumpPipe(["5 ft", "45 dg", "90 dg", "11 ft"]) → 24 sunFunPoolPumpPipe(["20 ft"]) → 20 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 280
Copyright Nick Parlante 2017 - privacy