Skip to main content

Mock 3 Slot3 - Handson - 21st July Java (30 Marks) 1. Farm Fest

Anuj has a mango farm. He sells the mangoes and earns money from them. He fills the mangoes in a basket. To make the calculation much simpler, he fills the basket either with an odd number of mangoes or with an even number of mangoes. If the number of mangoes is a combination of both an even and an odd number of mangoes, then he needs to rearrange the basket.

Note: Number of baskets cannot exceed 10 and cannot be zero or less, If so print “Invalid number of baskets”. A negative number of mangoes cannot exit, if so print "Invalid Input".

Sample Input 1:

Number of baskets

5

Number of mangoes in each basket

2

4

6

8

10

Sample Output 1:

Even

Sample Input 2:

Number of baskets

4

Number of mangoes in each basket

13

29

45

5

Sample Output 2:

Odd

Sample Input 3:

Number of baskets

3

Number of mangoes in each basket

12

13

14

Sample Output 3:

Rearrange the mangoes

Sample Input 4:

Number of baskets

0

Sample Output 4:

Invalid number of baskets

Sample Input 5:

Number of baskets

2

Number of mangoes in each basket

-12

13

Sample Output 5:

Invalid Input

Anuj has a mango farm. He sells the mangoes and earns money from them. He fills the mangoes in a basket. To make the calculation much simpler, he fills the basket either with an odd number of mangoes or with an even number of mangoes. If the number of mangoes is a combination of both an even and an odd number of mangoes, then he needs to rearrange the basket.  Note: Number of baskets cannot exceed 10 and cannot be zero or less, If so print “Invalid number of baskets”. A negative number of mangoes cannot exit, if so print "Invalid Input".  Sample Input 1:  Number of baskets  5  Number of mangoes in each basket  2  4  6  8  10  Sample Output 1:  Even  Sample Input 2:  Number of baskets  4  Number of mangoes in each basket  13  29  45  5  Sample Output 2:  Odd  Sample Input 3:  Number of baskets  3  Number of mangoes in each basket  12  13  14  Sample Output 3:  Rearrange the mangoes  Sample Input 4:  Number of baskets  0  Sample Output 4:  Invalid number of baskets  Sample Input 5:  Number of baskets  2  Number of mangoes in each basket  -12  13  Sample Output 5:  Invalid Input


Evaluation Result:


 

Result Description

Summary of tests
*Note: All the test cases might not have same weightage
+------------------------------+
|  8 tests run/ 8 tests passed |
+------------------------------+
 

Comments

Must Read:

Web Technology HTML 5 HTML 2 | Quiz 1

 Web Technology       HTML 5            HTML 2               Quiz 1  

Coin Change Combination

1. You are given a number n, representing the count of coins. 2. You are given n numbers, representing the denominations of n coins. 3. You are given a number "amt". 4. You are required to calculate and print the number of combinations of the n coins using which the       amount "amt" can be paid. Note 1: You have an infinite supply of each coin denomination i.e. same coin denomination can be                    used for many installments in payment of "amt" Note 2: You are required to find the count of combinations and not permutations i.e.                   2 + 2 + 3 = 7 and 2 + 3 + 2 = 7 and 3 + 2 + 2 = 7 are different permutations of same                    combination. You should treat them as 1 and not 3. Input Format A number n n1 n2 .. n number of elements A number amt Output Format A number representing the count of ...

Subscribe to Get's Answer by Email