QuestionQuestion

You have been asked by your manager to create a user-friendly application that will present a survey to your customers. The application will compile and analyze the results entered by the survey respondents who are customers who have shopped at your online store. You will deliver your working application with a design document and test results.

The following are requirements of the Survey class:
The Survey class will have a static class variable that stores the current respondent’s ID. As respondents complete the survey, this value will be incremented by one.
The Survey class will have an instance variable to hold the title of the survey.
The Survey class should have two overloaded constructors.
The first constructor should take no arguments. It should set the survey title to a default value of “Customer Survey”.
The second constructor should accept a String value for the survey title. It should reset the static respondent ID to zero. It should set the survey title to the value passed into the constructor.
The survey class should have a generateRespondentId() method which returns the next value of the respondent ID. This method should increment the static instance variable for the respondent ID by one.

To accomplish the task of developing your Survey class from your designed UML Class Diagram, you will need to implement the following variables and methods:
Static class variable for the respondentID
Instance variable for the Survey title
Two overloaded constructors
generateRespondentID() method.

Create a test class that tests your survey class. This should test all of the members added to this point in any way that you desire, as long as it is proven that they function as required.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Survey {
/*
• The Survey class will have a static class variable that stores the current respondent’s ID. As respondents complete the survey, this value will be incremented by one.
• The Survey class will have an instance variable to hold the title of the survey.
*/
    static String title;
    //private static int ID = 0;
    static int respondentID = 0; // field that is accesible to all methods of this class

    //Constructors
   
    // Default Constructor
    Survey() {
      
//The first constructor should take no arguments. It should set the survey title to a default value of “Customer Survey”.
       setTitle("Customer Survey");
       generateRespondentId();
       System.out.println("called Survey class first constructor!! yea!");
       ///LOOK at the instructions. The default constructor MUST do more than this
    }
   
/ Overloaded Constructor 1
    Survey(String iTitle) {
// o The second constructor should accept a String value for the survey title. It should reset the static respondent ID to zero. It should set the survey title to the value passed into the constructor
       setTitle(iTitle);
       setRespondentID(0);// It should reset the static respondent ID to zero
///LOOK   You are NOT setting respondentID to the correct value. Check the IP instructions
    }...
$25.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats