TCS Coding Question | Washing Machine Problem | TCS NQT

Problem Statement: A washing machine works on the principle of Fuzzy System, the weight of clothes put inside it for washing is uncertain But based on weight measured by sensors, it decides time and water level which can be changed by menus given on the machine control area.

For low level water, the time estimate is 25 minutes, where approximately weight is between 2000 grams or any nonzero positive number below that.

For medium level water, the time estimate is 35 minutes, where approximately weight is between 2001 grams and 4000 grams.

For high level water, the time estimate is 45 minutes, where approximately weight is above 4000 grams.

Assume the capacity of machine is maximum 7000 grams

Where approximately weight is zero, time estimate is 0 minutes.

Write a function which takes a numeric weight in the range [0,7000] as input and produces estimated time as output is: “OVERLOADED”, and for all other inputs, the output statement is


Input should be in the form of integer value –

Output must have the following format –

Time Estimated: Minutes


  • Input value


  • Output value

Time Estimated: 25 minutes

 class WashingMachine {
    static void MachineCapacity(int weight)
        else if(weight>0&&weight<=2000)
            System.out.println("Time Estimated:25 Minutes");
        else if(weight>2000&&weight<=4000)
            System.out.println("Time Estimated:35 Minutes");
        else if(weight>4000)
            System.out.println("Time Estimated:45 Minutes");
    public static void main(String[] args) {
Time Estimated:25 Minutes

Request:-If you found this post helpful then let me know by your comment and share it with your friend. 

If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all. 

If you have not subscribed my website then please subscribe my website. Try to learn something new and teach something new to other. 


Post a Comment