Questions


June 2021 1 24 Report


Question: Picnic Time

Tomorrow is the local picnic day and the parents are excited to take their children to the park. The organizers are giving some chocolates to the children. We know that every family has 2 children.

The organizers will give chocolates corresponding to the age of the children. So a family with a four-year old and a 7-year old child will get 11 chocolates.

However, if any of the child in that family is a teenager (between 13 to 19 inclusive), then that family receives a total of 40 chocolates.

Write a method Met that takes as parameters 2 integers, each storing the age of a child. You have to print the number of chocolates the family will get.

Only write the method - assume that the Class & main method have been defined.

Use the System.out.println() statement for printing.

Example Input: 4 7
Output: 11
Example Input: 11 20
Output: 31
Example Input: 5 13
Output: 40

Answers & Comments


Add an Answer


Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Helpful Social

Copyright © 2024 EHUB.TIPS team's - All rights reserved.