Question: The Survey class should have a method called topRatedQuestion(), which performs an analysis of all responses for each question and returns the number of the

The Survey class should have a method called "topRatedQuestion()," which performs an analysis of all responses for each question and returns the number of the question that had the most positive responses. The Survey class should have a method called "lowRatedQuestion()," which performs an analysis of all responses for each question and returns the number of the question that had the lowest responses. The Survey class should have a presentQuestion() method that takes an int value, which is the question number it should display to the user. The question number should be used to access the right question from the array of strings which hold the questions. Override the presentQuestion() method so that it takes both the question number and the respondent ID. The first argument is an int value, which is the question number it should display to the user. The second argument is an int, which is the respondent ID. If this method is called, both the respondent ID and the question will be displayed. The question number should be used to access the right question from the array of strings, which hold the questions. This allows you to present the question to the respondent in a more personalized way. For example: Respondent 5, please respond to the following survey question: How satisfied were you with your most recent visit? Implement the enhancements to your Survey class according to the requirements presented above. To accomplish the task of further developing your Survey class from your updated UML Class Diagram, you will need to implement the following attributes and methods: topRatedQuestion() method lowRatedQuestion() method presentQuestion() method with an int parameter for the question number Overloaded presentQuestion() method with int parameters for both the question number and Respondent ID.

This is what I have so far public class Survey

{

/** * @param args the command line arguments */

//Array, Static, and instance variables

//Static

private static int respondentID = 0;

//Instance

private String surveyTitle;

//Array to store 10 Questions.

private String[] Questions = new String[10];

//Array for 10 respondent's score

private int[][] Responses = new int[10][10];

Scanner input = new Scanner(System.in);

//Default constructor

public Survey() { surveyTitle = "Customer Survey"; }

//Overloaded constructor

public Survey(String title) { respondentID = 0; surveyTitle = title; }

//The survey class should have a generateRespondentId() method which returns

//the next value of the respondent ID.

public int getrespondentID() { respondentID++; return respondentID; }

//Method to getSurveyTitle

public String getSurveyTitle() { return surveyTitle; }

//Method to logResponse

public void logResponse(int respondentID, int questionNumber, int responseEntered)

{ Responses[respondentID][questionNumber-1] = responseEntered; }

public void displaySurveyResults(int num) { System.out.print("Question "+(num)+" : "+Questions[num-1]+" Reply : "); if(Responses[respondentID][num] == 0) { System.out.print("NO"); } else { System.out.print("YES"); } }

//Method to enterQuestions using loop.

public void enterQuestions() { for(int i = 0; i < 10; i++) { System.out.println("Enter Question "+(i+1)+" : ");

Questions[i] = input.nextLine(); } }

//Methods to displayQuestionStats

public void displayQuestionStats(int num) { int answer; System.out.print("Question "+(num)+" : "+Questions[num-1]+" (0-No/1-Yes) : ");

answer = input.nextInt(); logResponse(respondentID, num, answer); }

public static void main(String[] args) { } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!