Question

package week_3; /** Write a program that can help decide if a particular programming project is...

package week_3;

/**

 Write a program that can help decide if a particular programming project
 is best solved using a Waterfall or Agile methodology.

 Your program should ask the user:

 • How many programmers will be on the team   [ More than 30 programmers -> Waterfall ]
 • If there needs to be firm deadlines and a fixed schedule  [ Yes - > Waterfall ]
 • If the programmers have experience in requirements, analysis and testing as well as coding [ Yes - > Agile ]
 • If there are stringent quality control requirements   [ Yes -> Waterfall ]
 • If early integration is desirable   [ Yes -> Agile ]
 • If the customer will be requiring working models early in the process  [ Yes -> Agile ]
 
 There's a `yesNoInput` method in the InputUtils library that returns boolean values from yes/no user input.
 (If the user types 'n' or 'no', the method returns false. If the user types 'y' or 'yes' the method returns true.)
 
 Write a method called agileOrWaterfall,
 which takes this data as integer and boolean arguments.
 **The arguments should be provided in the order given above**.
 `agileOrWaterfall` will return a String, a suggestion on whether Agile, or Waterfall, or either, may be is best.
 
 To decide, check how many factors are in favor of Agile. If there are 4 or more factors in favor of Agile, then return `AGILE`.
 If there are 4 or more factors in favor of Waterfall, return `WATERFALL`.
 If there are an equal number of factors in favor of Agile and Waterfall, returns `EITHER`.
 
 Notice that there are three global constants AGILE, WATERFALL and EITHER.
 Your agileOrWaterfall method should return one of these Strings.
 
 Use your agileOrWaterfall method in your program to suggest which methodology to use.

 Your main method should do the task of asking questions and printing the result.
 Your agileOrWaterfall method should be given the relevant data, and do the processing,
 deciding, and returning the result.

 */
public class Question_3_Agile_Or_Waterfall {

    public final String AGILE = "Agile";
    public final String WATERFALL = "Waterfall";
    public final String EITHER = "Either";

    // don't modify this part
    public static void main(String[] args) {
        new Question_3_Agile_Or_Waterfall().methodology();
    }


    public void methodology() {

        // TODO Ask user the 6 questions
        // TODO Call the agileOrWaterfall method
        // TODO Use the suggestion agileOrWaterfall returns to print a message for the user.

    }


    // TODO write a public agileOrWaterfall method. It should have this name, and take
    // the 6 arguments needed, in the same order given in the description.
    // TODO this function should a String - one of the three Strings AGILE, WATERFALL or EITHER.
    // For example, if your method determines that Agile is best, write a statement like
    //      return AGILE;  // return the value in the AGILE constant

}
0 0
Add a comment Improve this question Transcribed image text
Answer #1


ANSWER

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

class Question_3_Agile_Or_Waterfall {

    public String AGILE = "Agile";
    public String WATERFALL = "Waterfall";
    public String EITHER = "Either";


    public static void main(String[] args) {
        new Question_3_Agile_Or_Waterfall().methodology();
    }

    public void methodology() {

        // TODO Ask user the 6 questions
        String ch[] = new String[6];
        Scanner sc = new Scanner(System.in);
        System.out.println("How many programmers will be on the team?:");
        int n = sc.nextInt();
        //[More than 30 programmers->waterfall]
        if (n > 30)
            ch[0] = "Waterfall";
        else
            ch[0] = "Agile";

        // If there needs to be firm deadlines and a fixed schedule [ Yes - > Waterfall ]
        System.out.println(" If there needs to be firm deadlines and a fixed schedule:");
        if (sc.next().charAt(0) == 'y')
            ch[1] = "Waterfall";
        else
    ch[1] = "Agile";
        //If the programmers have experience in requirements, analysis and testing as well as coding[Yes->Agile]
        System.out.println("If the programmers have experience in requirements, analysis and testing as well as codig:");
        if (sc.next().charAt(0) == 'y' )
            ch[2] = "Agile";
        else
    ch[2] = "Waterfall";
        //if there are stringent quality control requirements[Yes->waterfall]
        System.out.println("if there are stringent quality control requirements:");
        if (sc.next().charAt(0) == 'y' || sc.next().charAt(0) == 'Y' )
            ch[3] = "Waterfall";
        else
            ch[3] = "Agile";
        //If early integration is desirable[yes->Agile]
        System.out.println("If early integration is desirable:");
        if (sc.next().charAt(0) == 'y' || sc.next().charAt(0) == 'Y' )
            ch[4] = "Agile";
        else
            ch[4] = "Waterfall";

        //If the customer will be requiring working models early in the process[Yes->agile]
        System.out.println("If the customers will be requiring working models early in the process:");
        if (sc.next().charAt(0) == 'y' || sc.next().charAt(0) == 'Y' )
            ch[5] = "Agile";
        else
            ch[5] = "Waterfall";

        // TODO Call the agileOrWaterfall method
        String suggestion = agileOrWaterfall(ch);
        // TODO Use the suggestion agileOrWaterfall returns to print a message for the user.
        System.out.println("Programing project is best solved using" + suggestion + "methodology");
    }


        // TODO write a public agileOrWaterfall method. It should have this name, and take
        public String agileOrWaterfall(String ch[]){
            // the 6 arguments needed, in the order given in the description.


            // TODO this function should return one of the three Strings AGILE, WATERFALL or EITHER.

            int a = 0, w = 0, e = 0;
            for (int i = 0; i < 6; i++)
            {
                if (ch[i] == AGILE)
                    a++;
                if (ch[i] == WATERFALL)
                    w++;
                if (ch[i] == EITHER)
                    e++;
            }
            System.out.println(Arrays.toString(ch));
            if (a > 3)
                return AGILE;
            if (w > 3)
                return WATERFALL;
            else
                return EITHER;
          
        }
    }

Add a comment
Know the answer?
Add Answer to:
package week_3; /** Write a program that can help decide if a particular programming project is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • package week_3; import java.util.Scanner; import java.util.*; //import java.lang.*; //import java.io.*; /** Write a program that can...

    package week_3; import java.util.Scanner; import java.util.*; //import java.lang.*; //import java.io.*; /** Write a program that can help decide if a particular programming project is best solved using a Waterfall or Agile methodology. Your program should ask the user: • How many programmers will be on the team [ More than 30 programmers -> Waterfall ] • If there needs to be firm deadlines and a fixed schedule [ Yes - > Waterfall ] • If the programmers have experience in...

  • package week_3; /** Write a method called countUppercase that takes a String array argument. You can...

    package week_3; /** Write a method called countUppercase that takes a String array argument. You can assume that every element in the array is a one-letter String, for example String[] test = { "a", "B", "c", "D", "e"}; This method will count the number of uppercase letters from the set A through Z in the array, and return that number. So for the example array above, your method will return 2. You will need to use some Java library methods....

  • A java program for this question please! Recursion: A word is considered elfish if it contains...

    A java program for this question please! Recursion: A word is considered elfish if it contains the letters: e, l, and f in it, in any order. For example, we would say that the following words are elfish: whiteleaf, tasteful, unfriendly, and waffles, because they each contain those letters. Write a recursive method called elfish(), that, given a word, tells us whether or not that word is elfish. The signature of the method should be: public static boolean elfish(String word)...

  • Hi so I am currently working on a project for a java class and I am...

    Hi so I am currently working on a project for a java class and I am having trouble with a unit testing portion of the lab. This portion wants us to add three additional tests for three valid arguments and one test for an invalid argument. I tried coding it by myself but I am not well versed in unit testing so I am not sure if it is correct or if the invalid unit test will provide the desired...

  • Problem: Obscure Message You decide to write a program that obscures a sentence for you. You...

    Problem: Obscure Message You decide to write a program that obscures a sentence for you. You will write a function Obscure() that takes three string arguments and returns one string argument. The first argument is a substitution key, the second a substitution value, and the third a sentence. The program first uses substitution to obscure the sentence and then prepends AND appends the substitution value followed by and preceded by a space " ", respectively. The program should then return...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • Dictionary.java DictionaryInterface.java Spell.java SpellCheck.java In this lab you will write a spell check program. The program...

    Dictionary.java DictionaryInterface.java Spell.java SpellCheck.java In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the input file to be spell checked. The program will read in the words for the dictionary, then will read the input file and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is, add...

  • IN JAVA!!!! Write a method that returns the longest common prefix between a phrase A and...

    IN JAVA!!!! Write a method that returns the longest common prefix between a phrase A and a phrase B. If the two phrases do not share a common prefix, return the empty string “no prefix”. Your method should either take two strings or two char arrays as arguments (A, B) and return a string. Test your method in the main with these three pairings. Example A: snowball B: snowcone Return: “snow” A: river B: rover Return: “r” A: monday B:...

  • How to write a method in Java with these set of instructions: Method name will be:...

    How to write a method in Java with these set of instructions: Method name will be: public static boolean containsNumber(String[] array, String str) { // instruction: returns true if str is an element that is equal to an element of array // return false if str does not appear in array. // using compare String equality (str1.equals(str2). // JUST assume that array is not null and not empty // and NONE of strings in array is null. Assume str is...

  • Complete the code: package hw4; import java.io.File; import java.io.IOException; import java.util.LinkedList; import java.util.Scanner; /* * This...

    Complete the code: package hw4; import java.io.File; import java.io.IOException; import java.util.LinkedList; import java.util.Scanner; /* * This class is used by: * 1. FindSpacing.java * 2. FindSpacingDriver.java * 3. WordGame.java * 4. WordGameDriver.java */ public class WordGameHelperClass { /* * Returns true if an only the string s * is equal to one of the strings in dict. * Assumes dict is in alphabetical order. */ public static boolean inDictionary(String [] dict, String s) { // TODO Implement using binary search...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT