Groovy web console

subscribe to the feed Subscribe
to this
site

GroovyExercise

Published 1 week ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts

/** Groovy Exercise **/ 

class GroovyExercise {
    
    static main (args){
        
        println "Enter Status"
        def userInput= System.console().readLine().toLowerCase().replaceAll("\\s","")

        switch(userInput){
        
        case ['for_pickup', 'forpickup']: println "1200"; break;         
        case ['failed_pickup', 'failedpickup']: println "1300"; break;         
        case ['return_in_transit','returnintransit']: println "1400"; break;
        case ['at_sorting_center', 'atsortingcenter']: println "1500"; break;
        case 'delivered': println "1600"; break;
        default: println "Something else";        

        } 

    }

}