ICT167Assign1-18TSA.pdf - ICT167 Assignment 1 1 TSA 2018 MURDOCH UNIVERSITY ICT167 Principles of Computer Science TSA 2018 Assignment 1(worth 20 of unit

ICT167Assign1-18TSA.pdf - ICT167 Assignment 1 1 TSA 2018...

  • Murdoch University
  • ICT 167
  • Homework Help
  • XxbaidexX
  • 6
  • 100% (3) 3 out of 3 people found this document helpful

This preview shows page 1 - 3 out of 6 pages.

ICT167 Assignment 1 1 TSA, 2018 MURDOCH UNIVERSITY ICT167 Principles of Computer Science TSA, 2018 Assignment 1 (worth 20% of unit assessment) Due Date: Midnight, Sunday (Week 6) All Students : Submit the Assignment via LMS by the due date. Late penalty : 10% per day penalty for delayed submissions unless prior extension of deadline is obtained from the unit coordinator. You should keep a copy of your work. Your submission must include a completed assignment cover sheet. An electronic copy of the assignment cover sheet is available at the unit LMS site. This assignment consists of two questions. All questions are worth equal marks. Do not forget to press the [Submit] button after loading the assignment on to the LMS. Note that none of the questions require the use of arrays. WARNING: Take note of academic integrity issues. Read the information at the following link carefully. Question 1. A television rating service makes an internet survey of the viewing audience to sample the popularity of some TV shows. When information is collected concerning a particular show, the age (in the range 1 to 110) and gender (male/female) of the person surveyed, as well as whether that person watches the show regularly (Y/N), are recorded. Design, write in Java, test and document a program to process the data gathered for a show. The program is to output the total number of people surveyed, the number who said they watch the TV show regularly, and the percentage of those who watch the TV show regularly as in the example below. The total number of people surveyed = 50 The number of people who watch the show regularly = 20 The percentage of those who watch the show regularly = 40% The program should also print a table showing the percentages of those who watch the show regularly according to gender and age categories as in the example below. Distribution of viewers who watch the show regularly -------------------------------------------------------------------------------------------------- Gender % Under 30 % 30 or Over % Total -------------------------------------------------------------------------------------------------- Female 44 17 Male 23 16 -------------------------------------------------------------------------------------------------- Total 67 33 61 39 100
Image of page 1
ICT167 Assignment 1 2 TSA, 2018 The percentages in the table are rounded to the nearest whole number and are percentages of all those who watch the show regularly. Thus, the sum of percentages in the last column of the table must be 100% (ignoring any rounding error). Sample input: Please enter the person’s age (1..110): 25 Please enter the person’s gender (M/F): M Please enter whether the person watches the show regularly (Y/N): Y Do you want to enter another person’s details (Y/N)? Y The program should repeat until the user does not want to enter any more survey data for a particular show. The input data is to be validated. For example, if the user types in an integer outside the range 1 to 110 (for age), a letter other than ‘M’ or ‘m’ (for male), ‘F’ or ‘f’ (for female), ‘Y’ or ‘y’ (watches regularly), ‘N’ or ‘n’ (does not watch regularly), the program should output an appropriate error message and re-prompt for input until the user enters the correct data.
Image of page 2
Image of page 3

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture