{"id":420,"date":"2015-06-24T10:08:19","date_gmt":"2015-06-24T10:08:19","guid":{"rendered":"http:\/\/assignmenttask.com\/tutorhelp\/?p=420"},"modified":"2022-10-13T08:01:26","modified_gmt":"2022-10-13T08:01:26","slug":"java-programming-assignment-help-2","status":"publish","type":"post","link":"https:\/\/assignmenttask.com\/tutorhelp\/java-programming-assignment-help-2\/","title":{"rendered":"JAVA PROGRAMMING ASSIGNMENT HELP"},"content":{"rendered":"<h3>JAVA PROGRAMMING ASSIGNMENT<\/h3>\n<p><a href=\"http:\/\/assignmenttask.com\/order_now.html\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-442\" src=\"http:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png\" alt=\"Assignment Help from Experts Australia - UK &amp; US\" width=\"807\" height=\"275\" srcset=\"https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png 807w, https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3-300x102.png 300w\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" \/><\/a><\/p>\n<p>The context for this assignment (all parts) is the development of a small software desktop application in the context of keeping track of fuel consumption and money spent on petrol for drivers. The program will allow the user to check the average consumption for the last tank filling, average consumption for the last 5 tank fillings, average amount paid, as well as visualise the data from recent weeks.<br \/>\nThis assignment will test your knowledge of and skills in writing application software for a particular task, understanding the business rules of a particular problem, coding these in a computer program, developing a graphical user interface, connecting to a file and connecting to a database.<br \/>\nFor this assignment, you will use the Java programming language and development will be on the Eclipse IDE platform as practised in the computer lab classes.<br \/>\n<strong>Part A<\/strong><br \/>\nYou are to write a software desktop application using the <strong>Java programming language<\/strong>. The program enables a user, assuming that they are a motorist (car, motorbike, van, truck, etc.), to keep track of the fuel consumption and money spent on fuel. The user can enter the amount of fuel purchased at the petrol station, the kilometres driven, the total amount paid for the fuel, and the date of the purchase. To this end, you need to provide labels that guide the user as well as appropriate input GUI components (your choice of text fields, drop down menus, etc.).<\/p>\n<p>You have a great degree of freedom in what GUI elements you choose and how you would like to design the layout of your GUI. The above example is really just that \u2013 an example the design of which you can copy if you are feeling uninspired to come up with your own design. What matters is the functionality of the design and that the user can input the required data in a sensible fashion.<br \/>\nInput values for the fuel purchased, distance driven and amount paid are floating point values. The date needs to be entered as day, month, year. The average fuel consumption for the last tank filling and the average fuel consumption for the last 5 tank fillings need to be displayed as a floating point number with 1 decimal place. The average amount paid for the last 5 tank fillings needs to be displayed as a floating point number with two decimal places and the \u201c$\u201d sign in front.<br \/>\nThe drawing area needs to be at least 350 x 250 pixels in size (bigger is OK, but not smaller). The drawing area should have a clearly visible border. The drawing area should show labels for the current tank filling and the 4 most recent tank fillings. For simplicity, these can be labelled as \u201cWk1\u201d, \u201cWk2\u201d, &#8230;., \u201cWk5\u201d as an in the example above. There should be a baseline, drawn in black colour. The average consumption for the current tank filling and each of the 4 most recent tank fillings is to be shown as a bar graph (see example), with the bars drawn in the colour chosen by the user.<\/p>\n<p>To visualise the average fuel consumption for the current tank filling and across the current and the 4 most recent tank fillings, horizontal lines are to be drawn in the colours chosen by the user (see example).<br \/>\nYour task in Part A will be to develop a GUI that allows a user to input the data in a suitable GUI using Java Swing components and the Java WindowBuilder, and then to visualise the data. To this end, the user can<br \/>\n\uf0b7 input the data using Java Swing GUI elements, e.g. text fields, radio buttons, drop down lists, etc.,<br \/>\n\uf0b7 calculate various averages,<br \/>\n\uf0b7 visualise the consumption as a bar graph,<br \/>\n\uf0b7 select different colours for various elements, and<br \/>\n\uf0b7 exit the program in a defined way via a Quit button.<br \/>\nThe data should be entered through the GUI and<br \/>\n\uf0b7 the averages calculated when the Calculate button is clicked, and<br \/>\n\uf0b7 visualised when the Draw button is clicked.<br \/>\nData beyond the 5 weeks do not need to be saved in Part A, neither in memory (in an array or vector, for example), nor in a text file.<br \/>\n<a href=\"http:\/\/assignmenttask.com\/order_now.html\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-442\" src=\"http:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png\" alt=\"Assignment Help from Experts Australia - UK &amp; US\" width=\"807\" height=\"275\" srcset=\"https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png 807w, https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3-300x102.png 300w\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" \/><\/a><br \/>\nNotes:<br \/>\n\uf0b7 For this assignment, you do not have to do any checking for invalid user input (you may of course, if you want to), for example you do not have to check whether the user has typed in a negative number or a letter in the text boxes for fuel purchased, distance driven and amount paid. Checking for invalid user input will be discussed in lectures later in the semester.<br \/>\n\uf0b7 Your user interface does not have to be identical to the one above. This is just an example of how the GUI could look.<br \/>\n\uf0b7 Your GUI should update any labels in an appropriate manner when the user enters new data and clicks on the Calculate button.<\/p>\n<p>What the tutors will be looking for<br \/>\nThe tutor\u2019s instructions include<br \/>\n\uf0b7 Constants vs literals. Using constants is important for the ease of maintenance. Not using constants will result in lower marks. For example, consider using a constant for the width of each bar in the bar graph. (2 marks)<br \/>\n\uf0b7 GUI Design. Is it simple to use and easy to understand? Are all required components there? (4 marks)<br \/>\n\uf0b7 Program code layout. Separate blocks of code by a blank line. Use comments. (3 marks)<br \/>\n\uf0b7 A comment is not an essay. Comments are important for the maintenance of your program and should contain enough details, but keep them concise. Don\u2019t comment every single line. (2 marks)<br \/>\n\uf0b7 The program must have a prologue. (2 marks)<br \/>\n\uf0b7 Good names for your variables and constants. Check style against the Java style guide attached below. (4 marks)<br \/>\n\uf0b7 Does the program work correctly? Are the averages calculated correctly? Are the bar graphs drawn the right way? (10 marks)<br \/>\nTotal: 27 marks<\/p>\n<p>Step by Step Guide for Part A<br \/>\n1. Draw a sketch of your graphical user interface on paper. What Java Swing components will you use? Where will you place them? The above GUI is just an example. You can copy the design of it or create your own.<br \/>\n2. Create a new Java Project the same way as before (see lecture notes Lecture 1 Week 4 and Tutorial notes Week 5).<br \/>\n3. Add an Application Window to it (right-click on src, then New \u2192 Other \u2192 WindowBuilder \u2192 Swing Designer \u2192 Application Window<\/p>\n<p><strong>Part B<\/strong><br \/>\nIn Part B of the assignment, the input will not come directly from the user any more, but rather from a text file.<br \/>\nThe file fuel.txt contains the details of several tank fillings. Each line of this file contains the details of one tank filling. Each tank filling has a date, the amount of fuel purchased (floating point number), the distance driven (floating point number) and the amount paid (floating point number) as data on one line of the text file, separated by commas. The day, month and year in the date are integer numbers separated by \u201c\/\u201d.<br \/>\nHere\u2019s an example of one line from the text file:<br \/>\n12\/3\/2012,68.32,756.9,85.56<br \/>\nYou will need to copy fuel.txt into the same directory of your Eclipse project that holds the .project file.<br \/>\nYour task will be to add code to your program that reads the tank filling data from the text file, puts these into appropriate storage in memory (I suggest you create a data class similar to the example in star4.java and then create an array or vector that will hold each instantiation of that data class), adds the dates to a JList object, calculates and displays the average over all tank fillings in the text file, and upon selection of a date by the user, displays the average consumption for that date in a text label. You do not need to visualise this information as bar graphs (as in Part A).<\/p>\n<p>&nbsp;<\/p>\n<p>You can do all parts (A, B and C) in the same program, simply extend the GUI and add new methods \/ functions as required. Alternatively, you can create a separate GUI file for each part as long as they are all part of the same Java project.<br \/>\nFor testing, the details of the file may change, but the structure will not.<br \/>\nNotes:<br \/>\n\uf0b7 For this part of the Java assignment, add Java Swing GUI components that allow the user to select a date, via a JList, and that updates the calculations and text label displays with the information for the selected tank filling.<br \/>\n\uf0b7 The calculations and updates should occur as soon as a date is selected in the JList.<br \/>\n\uf0b7 Try to reuse code, such as the code for the calculation of the averages, from Part A. This will mean that you should have the GUI code separated from the calculation code (i.e. in a separate method or separate methods). This is good programming style!<br \/>\n\uf0b7 Remember that it is good practice to have a Quit button in your GUI to exit the program<\/p>\n<p>Part C<br \/>\nIn Part C of the assignment, the input will now come from a MS Access database contained in the file fuel.mdb. This file is available on the IIT \/ IST G web site on Moodle (UC LearnOnline).<br \/>\nThere is one table in the database, tblFuel.<br \/>\nThe table tblFuel contains fields \u201cdate\u201d, \u201cfuelPurchased\u201d, \u201cdistanceDriven\u201d, and \u201camountPaid\u201d. A typical record would be &lt;12\/3\/2012,68.32,756.9,85.56&gt;.<br \/>\nWrite a Java program with a GUI (Note: extending your GUI program from Parts A and B is perfectly acceptable, but you can also write a separate Java file for Part C; either way is fine and will not influence your marks) that allows the user to do the following:<br \/>\n\uf0b7 Let the user select a date from a list (e.g. JList) and display the information for the selected tank filling in appropriate text labels. Calculate and display the average fuel consumption for the selected tank filling. Calculate and display the average fuel consumption over all tank fillings in the database. (Let us assume these are all for the same verhicle.)<br \/>\n\uf0b7 Create a database report consisting of all dates, including the fields \u201cdate\u201d, \u201cfuelPurchased\u201d,<\/p>\n<p>\u201cdistanceDriven\u201d, and \u201camountPaid\u201d. The report should be in descending date order, i.e. the most recent date first. It should be written to a text file \u201cdatabaseFuel.txt\u201d. Make sure that your columns are properly aligned. Text columns should be left aligned, number columns (including date columns) right aligned.<br \/>\nNotes:<br \/>\n\uf0b7 You may extend your GUI from Part B to include Part C. If you do, label the parts clearly with \u201cPart A\u201d, \u201cPart B\u201d, and \u201cPart C\u201d, so that your tutors know which part of your program is in reply to what part of the assignment. Alternatively, you may write a separate file for Part C, but must ensure that it is part of the same Java project as Part A and B.<br \/>\n\uf0b7 Use a Disconnected Database Access model, i.e. connect to the database, run the SQL command, get the resulting virtual table in the ResultSet object, then disconnect again. Do not connect to the database and download \/ store all database information in local storage.<br \/>\n\uf0b7 You do not need to visualise this information as bar graphs (as in Part A).<\/p>\n<p>Reports<br \/>\nIn this part of the assignment, you will write a number of database reports. Each report should<br \/>\n\uf0b7 include a header,<br \/>\n\uf0b7 include a column header,<br \/>\n\uf0b7 have columns lined up, with text columns left justified and numeric columns right justified.<br \/>\n\uf0b7 make provision for multi-page reports. At least one of your reports should actually be more than one (fictional) page in length. Do this by defining the page length as 5.<br \/>\nAll reports should be written to a text file rather than the printer. If you wish, you can then use Notepad to produce a hardcopy of the reports. However, you do not need to submit a hardcopy of the report.<br \/>\nWhat the tutors will be looking for<br \/>\nThe tutor\u2019s instructions include (apart from the usual such as good variable names, prologue \/ comments, code layout, \u2026)<br \/>\n\uf0b7 Make sure that the lines in the database report is split into pages and the columns are lined up and correctly formatted. (4 marks)<br \/>\n\uf0b7 Correct connection to the database. (2 marks)<br \/>\n\uf0b7 Correct identification of all information in a date\u2019s tank filling data. (2 marks)<br \/>\n\uf0b7 Correct display of the information in text labels. (2 marks)<\/p>\n<p>Java Style Guide<br \/>\nGeneral<br \/>\nYour programs should be<br \/>\n\uf0b7 Simple<br \/>\n\uf0b7 Easy to read and understand<br \/>\n\uf0b7 Well structured<br \/>\n\uf0b7 Easy to maintain<br \/>\nSimple programs are just that. Avoid convoluted logic, nested if-statements and loops, duplicating execution (such as reading files multiple times), repeated code, being \u201cclever\u201d.<br \/>\nPrograms can be made easier to read by following the \u201cLayout\u201d and \u201cComments\u201d guidelines below.<br \/>\nWell structured code uses methods and functions to help tame complexity.<br \/>\nIf programs are simple, easy to understand and well structured they will be easy to maintain. Easily maintained programs will also use constants rather than literals, and use built-in functions and types.<br \/>\nLayout<br \/>\nThe text editor in the Eclipse IDE does a good job of automatically laying out your program. You can control this operation to some extent (using the Tools\/Options menu). However, you are unlikely to need to do so.<br \/>\n<a href=\"http:\/\/assignmenttask.com\/order_now.html\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-442\" src=\"http:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png\" alt=\"Assignment Help from Experts Australia - UK &amp; US\" width=\"807\" height=\"275\" srcset=\"https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3.png 807w, https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/service3-300x102.png 300w\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" \/><\/a><br \/>\n&nbsp;<\/p>\n<p><strong>To get java progeamming &nbsp;assignment help, please contact to our live chat adviser<\/strong><\/p>\n<p><a href=\"https:\/\/chatserver.comm100.com\/ChatWindow.aspx?planId=135&amp;visitType=1&amp;byHref=1&amp;partnerId=-1&amp;siteid=207633\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-196 aligncenter\" src=\"http:\/\/assignmenttask.com\/assignment-sample\/wp-content\/uploads\/2015\/06\/chat-now-300x113.png\" alt=\"chat expert for your assignment help\" width=\"300\" height=\"113\" srcset=\"https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/chat-now-300x113.png 300w, https:\/\/assignmenttask.com\/tutorhelp\/wp-content\/uploads\/2015\/06\/chat-now.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JAVA PROGRAMMING ASSIGNMENT The context for this assignment (all parts) is the development of a small software desktop application in the context of keeping track of fuel consumption and money spent on petrol for drivers. The program will allow the <a href=\"https:\/\/assignmenttask.com\/tutorhelp\/java-programming-assignment-help-2\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[313],"tags":[65,6,384,383,372,11,10],"class_list":["post-420","post","type-post","status-publish","format-standard","hentry","category-engineering","tag-assignment-help","tag-australia","tag-java-essay-help","tag-java-homework","tag-java-programming","tag-uk","tag-usa"],"_links":{"self":[{"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/posts\/420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/comments?post=420"}],"version-history":[{"count":3,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/posts\/420\/revisions"}],"predecessor-version":[{"id":1078,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/posts\/420\/revisions\/1078"}],"wp:attachment":[{"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/media?parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/categories?post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttask.com\/tutorhelp\/wp-json\/wp\/v2\/tags?post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}