Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 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 String ch[] = new String[6]; Scanner sc = new Scanner(System.in); System.out.println("How many program will be on the team:"); int n = sc.nextInt(); if (n > 30) ch[0] = "Wanterfall"; else ch[0] = "Agile"; System.out.println("When there is need to be firm deadlines and a fixed schedule:"); if (sc.next().charAt(0) == 'y') ch[1] = "Waterfall"; else ch[1] = "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"; 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"; 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"; 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 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 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; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started