Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Internet and the web enable people to network, join a cause, and so on. The

ID: 674953 • Letter: T

Question

The Internet and the web enable people to network, join a cause, and so on. The presidential candidates in 2012 used the Internet to get out their messages and raise money. In this exercise, you’ll write a polling program that allows users to rate five social-consciousness issues from 1 to 10 (most important). Pick five causes (e.g., political issues, global environmental issues). Use a one-dimensional string array topics to store the causes. To summarize the survey responses, use a 5-row, 10-column two-dimensional array responses (of type int), each row corresponding to an element in the topics array. When the program runs, it should ask the user to rate each issue. Have your friends and family respond to the survey. Then have the program dispay a summary of the results, including:

a) a tabular report with the five topics down the left side and the 10 ratings across the top, listing in each column the number of rating recieved for each topic.

b) To the right of each row, show the average of the rating for that issue.

c) which issue recieved the highesst point total? Display both the issue and the point total.

d) Which issue recieved the lowest point total? Display both the issue and the point total.

Explanation / Answer

Answer:

Note: since Language is not mentioned .so I implemented program in Java.

//INCLUDE HEADER FILES

import java.io.*;

import java.util.*;

//CLASS

public class pollingIMP

{

//MAIN METHOD

public static void main(String[] args)

{

//SCANNER TO READ INPUT FROM THE USER

    Scanner rateIn = new Scanner(System.in);

//STRING ARRAY TO HOLD 5 ISSUES

     String[] socialIssue={"Pollution","Tsunami","Equal Rights","Developments in medical field ","Food Shortage"};

//GENERATE RANDOM

    Random randNo = new Random();

    int poll = randNo.nextInt(5) + 5;

//ARRAY OF 5ROWS AND 10 COLUMNS

    int [][] POLLRATES= new int[5][10];

//GET RATING FROM THE USER FOR EACH ISSUE

    for (int k1 = 0; k1 < poll; k1++)

        {

        System.out.println("Person #" + k1+1);

        System.out.println("RATE THE FOLLOWING ISSUES FROM 1TO 10:");

        for (int k2 = 0; k2 < socialIssue.length; k2++)

            {

            System.out.println(socialIssue[k2]);

            POLLRATES[k2][k1] = rateIn.nextInt();

        }

    }

//CALCULATION PART

     int minPollRating = 10;

    int maxPollRating = 0;

    int minPollRatingIndex = 0;

    int maxPollRatingIndex = 0;

    for (int k1 = 0; k1 < socialIssue.length; k1++)

        {

        System.out.print(socialIssue[k1]+":");

        int totRating = 0;

        for (int k2 = 0; k2 < poll; k2++)

            {

            System.out.print(" "+POLLRATES[k1][k2]);

            totRating += POLLRATES[k2][k1];

        }

//DISPLAY THE AVERAGE OF EACH ISSUE

        double avgRate = ((double)totRating)/poll;

        System.out.println(" Average ofRating: "+avgRate);

        if (totRating < minPollRating )

            {

            minPollRating = totRating;

            minPollRatingIndex = k1;

        }

        if (totRating > maxPollRating ){

              maxPollRating = totRating;

            maxPollRatingIndex = k1;

        }

    }

//DISPLAY MAXIMUM RATED ISSUE

    System.out.println("Max points: "+socialIssue[maxPollRatingIndex]+": "+maxPollRating+" points");

//DISPLAY MINIMUM RATED ISSUE

    System.out.println("Min points: "+socialIssue[minPollRatingIndex]+": "+minPollRating+" points");

    System.out.println();

}//MAIN ENDS

}//CLASS ENDS

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote