In this assignment, you will build a browser of Portuguese “Vinho Verde” wine samples. This project will make substantial use of the material you have been taught in the course. In particular, you will employ OO programming, the Java Collections Framework, Java Swing and event handling for the GUI-building
Microsoft Word - PortuguesWineBrowser_COM1003_2019.docx COM1003 Java Programming – Semester 2 Java Programming Assignment: A Portuguese wine browser Submission deadline 3pm on Friday 10 May. Note, this is an individual assignment. You are not allowed to work in groups and your code must be all your own work. You may not use other peoples’ code or ideas, e.g., taken from the Internet. Any form of unfair means (plagiarism or collusion) will be treated as a serious academic offence and will be processed under our University Discipline Regulations. These might result in a loss of marks, a possible failure of the module or even expulsion from our University. For further details, please visit the UG student handbook section on this topic: https://sites.google.com/sheffield.ac.uk/comughandbook-201819/general-information/assessment/unfair- means In this assignment, you will build a browser of Portuguese “Vinho Verde” wine samples. This project will make substantial use of the material you have been taught in the course. In particular, you will employ OO programming, the Java Collections Framework, Java Swing and event handling for the GUI-building. To make sure that this assignment is feasible within the time available, several classes are provided to help you to get started, and you must use and include these classes in your submission. Before you begin, read all of this document carefully. It is intended to provide you with sufficient detail to get started with the assignment. You need to read this document along with the classes that have been provided to you. They need to be studied together. The comments provided in the code are written to help you. You are also strongly recommended to begin work on the assignment soon, do not leave it until the last minute. General Background Assessing the quality of wines is critical to the wine industry in countries producing this good. In this project, you will: - Build a browser that will allow wine producers of the Portuguese “Vinho Verde” variety to explore the quality of their wine, based on the wine samples previously collected by them. Your browser will handle two wine types: red and white. Each wine sample is characterized by a list of wine properties. The wine properties were obtained from a battery of objective tests (e.g. pH values, acidity) and subjective ones based on sensory data (median of at least 3 evaluations made by wine experts). Each expert graded the wine quality with a numerical value between 0 (worst) and 10 (best). More details about the wine properties included in the dataset are provided in the section ‘The wine samples data’. - Display on the console the answer to a number of questions describing the datasets containing the wine sample data. More details about the questions are provided in the section ‘The questions’. - Provide the user the ability to systematically explore and evaluate the quality and properties of these wine samples. To do that, a list of queries will be provided to your browser via a text file. The results will be displayed on the console. You can assume that there will be no formatting errors in the provided list of queries. You can find the details describing the syntax of these queries and what they are meant to do in the section ‘The queries’. - Provide the user the possibility of interacting via a GUI with the wine sample data by using user-defined filters (queries created by the user via GUI). You should be able to display the results interactively. You can find the details about how the GUI will need to operate in the section ‘The GUI’. The wine samples data You can download the two original datasets for the red and white Portuguese “Vinho Verde” varieties from MOLE. Both datasets were collected as part of a research project and made publicly available by the creators in the UCI Machine Learning Repository 1 . The filenames of these two datasets will be provided to your main class (WineSampleBrowser.java). The first argument will refer to the file containing the red wine samples and the second argument to the one containing the white wine samples. Both files are text and use the Comma Separated Values file format (CSV). In this case, the first row provides the twelve categories listed below and the remaining rows list the numerical values for each of the wine samples in the datasets. You are advised to use spreadsheet software to verify that your program is working as desired (e.g. Excel, Google Sheet, Numbers…). In Excel this means using its ability to load CSV files and Data-Filter capabilities. There are many online tutorials showing how to use this last feature (e.g. https://youtu.be/_OdsZR_rL1U). Below you can find a brief description of the wine properties available for each wine sample (these are the twelve values listed in the first row of the CSV file): Wine Properties - Objective physicochemical measurements: 1 - fixed acidity 2 - volatile acidity 3 - citric acid 4 - residual sugar 5 - chlorides 6 - free sulfur dioxide 7 - total sulfur dioxide 8 - density 9 - pH 10 - sulphates 11 – alcohol Wine Properties - Subjective wine quality assessment (based on sensory data): 12 - quality (score between 0 and 10) You do not need to know much about these and other terms to do this assignment, but if you wish to find out more, check the paper referenced in the UCI Machine Learning repository. Note that the datasets do not provide a wine sample ID. You do not need to worry about that as the classes that you have been provided already assign an ID to each of the wine samples. Please, study the class AbstractWineSampleCellar and its readWineFile method. 1 http://archive.ics.uci.edu/ml/datasets/Wine+Quality The questions Your application should be able to answer the following ten questions and display the results in the console: Q1. How many wine samples are there? Q2. How many red wine samples are there? Q3. How many white wine samples are there? Q4. Which wine samples were graded with the best quality?* Q5. Which wine samples were graded with the worst quality?* Q6. Which wine samples have the highest PH?* Q7. Which wine samples have the lowest PH?* Q8. What is the highest value of alcohol grade for the whole sample of red wines? Q9. What is the lowest value of citric acid for the whole sample of white wines? Q10. What is the average value of alcohol grade for the whole sample of white wines? *At least for questions Q4-Q7, when you display the answer, you will also need to show the list of wine sample ID/s, their wine properties and wine type (red or white). Note that for many of the questions above, there might be multiple wine samples providing the answer. The output on the console could2 appear as follows to answer questions Q1-Q10. Note that for some of these questions there might be multiple wine sample providing the answer (in the example below this happens for Q4). Q1. Total number of wine samples: 234 Q2. Number of RED wine samples: 120 out of 234 Q3. Number of WHITE wine samples: 114 out of 234 Q4. The best quality wine samples are: * Wine ID 3 of type WHITE with a quality score of 9.0 * Wine ID 23 of type WHITE with a quality score of 9.0 * Wine ID 45 of type WHITE with a quality score of 9.0 … The queries Your main class (WineSampleBrowser.java) will receive as third argument another filename. That file will contain a list of individual queries of the form: select red where qual > 6 select white or red where qual < 6="" and="" qual=""> 4 and pH > 2.8 In the example above, the first query should produce all red wine samples whose quality is greater than 6. The second should find white or red wine samples whose quality is between 4 and 6, with a pH above 2.8. In general, queries will be built as follows: select [red | white | red or white | white or red] where [conditions] where the[conditions] can have as many and clauses as specified by the user. Note that the or clause can only be used to select the type of wine samples (i.e. in the first part of the select statement when indicating “red or white”, but not in the list of query conditions)3. For example, to select all red wine samples with fixed acidity above 8, quality below 5, and pH between 2.7 and 2.79, one would use a slightly more complex query such as: select red where f_acid > 8 and qual < 5="" and="" ph=""> 2.7 and pH < 2.79="" 2="" this="" is="" only="" indicative="" and="" the="" results="" shown="" do="" not="" correspond="" to="" the="" datasets="" you="" have="" been="" provided.="" 3="" this="" is="" meant="" to="" simplify="" your="" programming="" task.="" the="" [conditions]="" in="" your="" queries="" will="" be="" your="" query="" conditions="" and="" they="" should="" support="" the="" following="" comparison="" operators:="" operator="" meaning=""> Larger than >= Larger than or equal to = Equal to != Not equal to< less="" than=""><= less>= less>