Must accepts "Maestro Cards"
Tax for bike should be less than 15
Total number of lanes is more than 10
Must provides monthly pass
Write a method:

boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes);

String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card
String[] tollTax A String array of toll tax chart (say “Train : 300”,”BullCart : 10”)
boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not
int numberOfLanes This parameter defines the number of lanes for each side



Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes i..

Answer / Aditya Vikram Singh

Here's the implementation in Java:

```
public boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes) {
boolean isGood = false;
if (cardsAccepted != null && Arrays.asList(cardsAccepted).contains("Maestro")) {
if (Arrays.stream(tollTax).anyMatch(tax -> Integer.parseInt(tax.split(&quot;:&quot;)[1]) < 15)) {
if (numberOfLanes > 10) {
if (hasMonthlyPass) {
isGood = true;
}
}
}
return isGood;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are proxy objects in c++?

1 Answers  


How to construct muliton object

2 Answers   Symphony, TCS,


What does namespace mean in c++?

1 Answers  


What is a protocol class?

1 Answers  


Describe protected access specifiers?

1 Answers  


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1 Answers  


Explain differences between new() and delete()?

1 Answers  


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


Is python better than c++?

1 Answers  


Differentiate between the manipulator and setf( ) function?

1 Answers  


5. Can inline functions have a recursion?

4 Answers  


What is a storage class?

1 Answers  


Categories