CSCI-1320 Homework 13: Static Methods

Instructor: Todd Dole

Purpose Statement

This assignment gives opportunity to practice with static methods. We will create several methods, and give the user a menu to choose which one to call.

Instructions

Create a class called MethodLab, with a main method (just like we've done in the past.) For now, leave the main method empty.

Above the main method, create the following additional methods (using public static void):

Once you have created these methods, move on to the main method. In main, write a loop which gives the user a menu, prompts them to choose an item, and then calls the appropriate method.
You can use a switch statement or a series of if statements to control which method will be called. (Note that to do the assignment correctly, you must print the various messages--greeting, encouragement, or bible verse--from inside the specific method for that selection, not from within main.)

Your if statements might look something like this:

            if (choice==1) {
                greetingMessage();
            }
        
NOT like this:
            if (choice==1) {
                system.out.println("Hello, and welcome to my program!");
            }
            

The loop should continue until the user chooses to exit.

Your output might look something like this:

                Hello, please select from the following options:
                    1. Greeting Message
                    2. Encouragement Message
                    3. Bible Verse
                    4. Quit
                Which do you choose?  3
                You chose Bible Verse.  Here is my favorite verse:
                Zephaniah 3:17 "The LORD your God is in your midst, a mighty one who will save;
                he will rejoice over you with gladness; he will quiet you by his love; he will exult over you with loud singing."

                Hello, please select from the following options:
                    1. Greeting Message
                    2. Encouragement Message
                    3. Bible Verse
                    4. Quit
                Which do you choose?  4
                Goodbye!