This program is to show the percentages of those who watch a TV show regularly. The distribution of the percentages is on the basis of gender (male and female) and age (below 30 or over 30). The Title of the program is TV show ratings developed by Wong Zhi Hui Chester, student number 33369733 on October 12, 2018. This program is developed in Java using netbeans. A file named ques1.java is developed for the same.
Requirement/Specification
The program is supposed to provide a distribution of percentages of people who watch a particular TV show for which survey is done. The distribution of the percentages is divided into males and females and for the people who are of age 30 or above or below 30. Each survey entered by the user is stored in a memory for the evaluation and corresponding calculations are done for the same. When all the surveys are entered by the user, then a table distribution is shown to the user for analysis.
User Guide
To access, compile and run the program, please follow the following commands:
Limitations
There is only one limitation to this program, while entering the age of any person in the program, if user enters anything other than an integer, the program will abort. As there is no exception handling in the program.
public static void StudentInfo(){
System.out.println(“Name:tttWong Zhi Hui Chester”);
System.out.println(“Student no.tt33369733”);
System.out.println(“Mode of enrollmenttfull time”);
System.out.println(“Tutor namettMr Chong“);
System.out.println(“AttendancettEvery Thursday, 10:30am to 1230pm”);
public static int inputAge(Scanner scan){
System.out.println(“Please enter the person’s age (1..110):”);
age = Integer.parseInt(scan.nextLine());
}while(age < 1 || age > 110);
return age;
public static String input(Scanner scan, String display, String option1, String option2){
System.out.println(display);
ans = scan.nextLine();
}while(!ans.equalsIgnoreCase(option1) && !ans.equalsIgnoreCase(option2));
return ans.toUpperCase();
public static void main(String[] args)
StudentInfo();
System.out.println(“nnn”);
String anotherShow;
Scanner scan = new Scanner(System.in);
double femaleBelow30 = 0, femaleOver30 = 0;
double maleBelow30 = 0, maleOver30 = 0;
String repeat;
int age = inputAge(scan);
String gender = input(scan, “Please enter the person’s gender (M/F):”, “m”, “f”);
String watchShow = input(scan, “Please enter whether the person watches the show regularly (Y/N):”, “y”, if (watchShow.equals(“Y”)) {
switch (gender) {
case “M”:
if (age < 30) {
maleBelow30++;
} else {
maleOver30++;
break;
case “F”:
if (age < 30) {
femaleBelow30++;
} else {
repeat = input(scan, “Do you want to enter another person’s details (Y/N)?”, “y”, “n”);
} while (!repeat.equalsIgnoreCase(“n”));
double total = femaleBelow30 + femaleOver30 + maleBelow30 + maleOver30;
System.out.println(“Distribution of viewers who watch the show regularly”);
System.out.println(“————————————————————————————————–“);
System.out.println(“Gendert% Under 30t% 30 or Overt% Total”);
System.out.println(“————————————————————————————————–“);
femaleBelow30 = (femaleBelow30 / total) * 100;
femaleOver30 = (femaleOver30 / total) * 100;
double female = femaleBelow30 + femaleOver30;
maleBelow30 = (maleBelow30 / total) * 100;
maleOver30 = (maleOver30 / total) * 100;
double male = maleBelow30 + maleOver30;
System.out.println(“Femalett” + Math.round(femaleBelow30) + “tt” + Math.round(femaleOver30) + “tt” + Math.round(female));
System.out.println(“Malett” + Math.round(maleBelow30) + “tt” + Math.round(maleOver30) + “tt” + Math.round(male));
System.out.println(“————————————————————————————————–“);
System.out.println(“Totaltt” + Math.round(femaleBelow30 + maleBelow30) + “tt” + Math.round(femaleOver30 + maleOver30) + “tt” + Math.round(female + male));
anotherShow = input(scan, “Do you want to enter for another show (Y/N)?”, “y”, “n”);
}while(!anotherShow.equalsIgnoreCase(“n”));
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download