Java programing assignment

hello,Here’s my Kava assignment I need help on itIt’s for beginer level, I really need help cause the due date is already over, and I got 2 extra date extinction.Thanks
_java_programming_assignment_marking_feedback__1_.pdf

javaassignmentfinal__2_.pdf

Don't use plagiarized sources. Get Your Custom Essay on
Java programing assignment
Just from $13/Page
Order Essay

Unformatted Attachment Preview

Java Programming Assignment – Trimester 1, 2018 – 4478 IIT
Marked by: __
Student ID: ____________ Student name: _______________________
Part A (Stage 1 – Console version)
Items
Correctness:
? Is the code compiling and overall
correct? Which parts are working if not
all?
? Is the calculation of the average daily
rainfall for each month correct? Are
doubles used to store the monthly
rainfall data?
? Have leap years been accounted for
correctly?
? Is the total rainfall correct?
? What approach was used for the
calculations?
Bonus point for innovative
approaches
? Do the inputs via the console work
correctly?
Constants versus Literals:
? Are constants being used, e.g. for the
number of months in a year, or for
giving text fields / areas the same width
and height?
? Using constants is important for the
ease of maintenance.
Code Layout:
? Has the code been structured in a
logical way?
? Are variables and constants defined at
the start of the class (for global
variables / constants) or start of a
method / function (for local variables /
constants)?
? Separate blocks of code by a blank line
? Has the student used levels of
indentation for blocks of code and has
done so consistently?
? Use of comments (beyond the ones
automatically placed there by Eclipse)
? Each class / method / function must
have a comment on the lines before it
? Does each file have a prologue? Who
was the author, when was it written,
when was it last changed, what does it
do, what are the inputs and outputs?
(See Java style guide at the end of the
assignment description)
? Additional comments for blocks of code
inside the methods
Comments
Mark
of 10
of 2
of 8
Programming Style:
? Has the student used good names for
variables, constants, methods etc.?
? For example, jButton1, jButton2, … are
not good names.
? Check against Java style guide in the
assignment description
of 5
Part A Total: of 25
Part B (Stage 2 – GUI version)
Items
Correctness:
? Does the program work correctly? Is
the calculation of each month’s
average daily rainfall and the total
rainfall for the year correct?
? Has the same approach being used as
in Stage 1? Reusing previously written
code is an important part of software
development.
? Do the inputs via the GUI work
correctly?
? Is the code compiling and overall
correct?
? Is the calculation of the averages and
annual rainfall triggered by clicking on
a ‘Calculate’ button?
GUI Design (Stage 2):
? Is the GUI simple to use and easy to
understand?
? For example, does the GUI have labels
to guide the user?
? Are the elements well aligned or all
over the place?
? Are all required components there?
? Are buttons and event handlers
working correctly?
? Did the student use some innovative
concepts beyond the design in the
handout (e.g. file menu)? Bonus pt.
General Comments:
? Good variable names
? Code layout
? Prologue / comments
? Has the style guide been followed?
Comments
Mark
of 5
of 5
No
marks
Part B Total: of 10
Part C (Stage 3 – Read data from a text file)
Items
Use of Constants:
? Are constants being used, e.g. for
aligning GUI elements, for the width
and height of text fields, etc.?
Comments
Mark
of 2
Reading of Text File:
? Is the text file being read correctly?
Are all lines read?
? Is the text file only read once?
Triggering of drawing when JList selection
is made:
? Is the JList correctly filled with the
station name/year read from the file?
? Are the calculation of the average
daily rainfall and the drawing of the
bar graphs triggered when the user
selects a different station/year?
(Event handler for the JList selection)
? Are the heights of the bars correct in
size relative to the monthly rainfall?
Use of Methods / Functions:
? GUI code should be separated from
drawing functionality
? A separate class should be defined
for the drawing, extending the JPanel
class
? Have the paintComponent and
clear methods been redefined?
? How has the student solved the
problem of accessing the values of
the rainfall data for each station/year,
calculated in the main class, and
knowing, which station has been
selected in the JList, so as to draw
the bar graph of the monthly rainfall
with the lowest and highest rainfall in
different colours?
Data Storage:
? Has the student used a suitable way
of storing the data after reading the
text file?
? What approach has been used? This
could include multi-dimensional
arrays, vectors, use of a data class (in
combination with arrays or vectors),
etc.
of 2
of 3
of 4
of 4
?
Using a properly designed data class
is the preferred way.
General Comments:
? Good variable names
? Code layout
? Prologue / comments
? Has the style guide been followed?
No
marks
Part C Total: of 15
Java Assignment Total (Part A + B + C):
Java Programming Assignment
(2018 Term 1)
Introduction to Information Technology 4478
Note 1: Only use Java classes that are part of the standard Java SE SDK distribution! For
the purpose of this assignment, you are not allowed to use any third party classes.
Note 2: Familiarise yourself with the Java Style Guide at the end of this document.
All cases of plagiarism will be pursued! If in doubt, consult the Student Academic
Integrity Policy https://guard.canberra.edu.au/policy/policy.php?pol_id=3175 or ask your
lecturer.
The context for this assignment (all parts) is rainfall data. This assignment will test a
student’s 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, reading data from a text file on disk, and
connecting to an SQL database from within the program. As such, the assignment
requires you to integrate and synthesise what you have learnt so far, in order to design
and create a correctly working solution. For this assignment, students will use the Java
programming language and development will be on the Eclipse IDE platform as practised
in the computer lab classes. This assignment consists of several stages.
? Stage 1: A simple console program (no GUI)
? Stage 2: The same but wrapped in a GUI
? Stage 3: Input comes from a text file – read only once, then information stored in
a suitable data class, array, etc.
4478 IIT
Part A – Stage 1 (25 marks)
Part B – Stage 2 (10 marks)
Part C – Stage 3 (15 marks)
Note that although there are bonus marks available, they only allow you to pick up extra
marks to make up for marks lost elsewhere in the assignment, but note that you cannot
achieve more than 50/50 marks.
1. This assignment is to show your understanding of simple programming constructs;
assignment statements, calculations, loops and arrays. For part A you will write a
simple Java program to calculate the average daily rainfall for each month of a given
year, given the total rainfall for each month. You will also calculate the total annual
rainfall. Note: All rainfall data used in this document and in the assignment text file
& database comes from www.bom.gov.au
In order to calculate the average daily rainfall for a given month, we need to know how
many days there are in a month. In a non-leap year, these are:
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
31
28
31
30
31
30
31
31
30
31
30
31
However, in a leap year, the month of February will have 29 days.
Leap years occur when:
a. The year is evenly divisible by 4 (for example, 1996, 2004, 2008 etc.).
b. If the year can be evenly divided by 100, then it is not a leap year (for example,
the year 1900 was not a leap year).
c. Unless it is also evenly divisible by 400, in which case it is a leap year (for
example, the year 2000 was a leap year).
Test Cases
When designing and implementing software applications, it is always important to first
work out how to test the program(s) and what data to use, then to code. The following
test cases have been designed to systematically test different conditions in the above
rules. Use these to test your program, but make sure that your program can also handle
other data.
Sydney
Sydney
Canberra
Canberra
Station:
BG
avg daily BG
avg daily Botanical G avg daily Botanical G avg daily
Year:
1900
1988
2000
2017
Rainfall
Data
43.7 1.409677
96.3 3.106452
39.1 1.261290
10.9 0.351612
Jan
39.1 1.396429
100 3.448276
13.8 0.475862
21.3 0.760714
Feb
109.2 3.522581
79 2.548387
39.6 1.277419
84.9 2.738709
Mar
151.9
5.063333
347.7
11.590000
71.4
2.380000
44.1
1.47
Apr
319 10.290323
272.4 8.787097
73.4 2.367742
46.5
1.5
May
282.7 9.423333
86.1 2.870000
29 0.966667
0.4 0.013333
Jun
326.9 10.545161
109.3 3.525806
31.9 1.029032
20.2 0.651612
Jul
12.4
0.400000
72.1
2.325806
82.6
2.664516
51.1 1.648387
Aug
64.8 2.160000
145.2 4.840000
86.5 2.883333
18.7 0.623333
Sep
2.5 0.080645
0.6 0.019355
80.6 2.600000
72.9 2.351612
Oct
187.7 6.256667
166.1 5.536667
153 5.100000
87.9
2.93
Nov
44.5
1.435484
132.7
4.280645
20.4
0.658065
112.9
3.641935
Dec
Total
1584.4
1607.5
721.3
571.8
Submission Instruction
Add all Java files (ending in .java) to a ZIP file. You do not need to zip the entire project
folder, just the Java source file(s) (the ‘src’ folder). Submit the ZIP file via Moodle (max.
size 10MB). When ready for marking, make sure you click on “Submit the Submission”.
There is no need for a cover sheet. By electronically submitting your assignment on
Moodle, you acknowledge that this submission is your own work.
Stage 1: (25 marks).
Write a simple Java program to calculate the average daily rainfall for each month of a
given year, given the total rainfall for each month. Also calculate the total rainfall for the
year.
In Stage 1, you will be developing a Java program without a GUI. Input and
output are via the console.
Step-by-Step Guide for Stage 1
1. Think about your strategy first of how you will compute the average daily rainfall
based on the above rules. Different strategies are possible. Here is one:
a. Use an integer array of 12 elements to hold how many days each month
has.
b. If the month entered is February, check to see if the year is a leap year. If
so, add an extra day to the number of days in the month.
c. Divide the rainfall for the month by the number of days in the month.
d. The result of the calculation is the average daily rainfall for that month.
2. Create a new Java project.
3. Add a simple Java class named Stage1. Do not add a GUI.
4.
In the Stage1 class (file Stage1.java), you may put all code for the user
interaction and the calculation into the main method. (You might still need to
define global variables and constants outside the main method at the start of the
class.) Declare and instantiate the variables that you will need, for example:
int iYear;
int[] iaMonthLength = {31,28,31,30,31,30,31,31,30,31,30,31};
Double [] daMonthRain = new double[12];
5. In the main method, add code to read in the year, then the twelve values for the
rainfall for each month, from the console. In Java, there are different ways to do
this. A recommended way is to use the Scanner class:
Scanner inConsole = new Scanner(System.in);
// Read the year
System.out.println(“Enter the Year”);
iYear = inConsole.nextInt();
// Read the rainfall data
System.out.println(“Enter rainfall for January: “);
daMonthRain[0] = inConsole.nextDouble();
Repeat (and adapt) the last two lines for the other rainfall data for the rest of the
months
5. Now add the code that implements your strategy of calculating the average daily
rainfall for each month and the total rainfall for the year.
6. Finally, add System.out.println() statements that state the average daily rainfall
for each month and the total rainfall for the year.
7. Test your implementation with the test cases mentioned above (and additionally
your own).
What the tutors will be looking for
The tutor’s instructions include
?
Constants vs literals. Using constants is important for the ease of maintenance.
Not using constants will result in lower marks. For example, consider constants
for the default number of months.
?
Program code layout. Separate blocks of code by a blank line. Use comments.
?
A comment is not an essay. Comments are important for the maintenance of a
program and should contain enough details, but keep them concise. Do not
comment every single line.
?
The program must have a prologue. Check style against the Java style guide
attached below (last 4 pages).
?
Good names for your variables and constants. Check style against the Java style
guide attached below (last 4 pages).
?
Does the program work correctly?
Please refer to the Java Assignment Marking Feedback sheet for details on marks.
Stage 2
As the user input and program output via the console is not very satisfactory from a
human-computer interaction and usability point of view, your task in this stage is to
design and implement a Java Swing GUI application (using the built-in WindowBuilder
in Eclipse and Java Swing components) that provides an easy to use interface.
This GUI application must allow a user to input the year and the rainfall data for each
month. To this end, the user can
? input the data using Java Swing GUI elements, e.g. text fields, radio buttons, drop
down lists, etc.,
? click on a Calculate button that starts the calculation of the average daily rainfall
for each month from the current input and displays the output (including the total
rainfall), and
? an Exit or Quit button to properly close the program.
Use the same code for the calculation of the scores as in Stage 1. Reusing code is an
important part of software development.
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 below example is really just that – an
example the design, which you may 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.
Example of what the “empty” GUI might look like. You are free to use your own layout
and other GUI elements, as long as the functionality is correct.
Notes:
? 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 fields for
rainfall for each month. Checking for invalid user input will be discussed in
lectures later in the term.
? Your user interface does not have to be identical to the one above. This is just an
example of how the GUI could look.
? Your GUI should update the output labels for the average rainfall for each month,
and the label “Total Rainfall“ in an appropriate manner with the calculated value
based on the rules when the Calculate button has been clicked.
What the tutors will be looking for
The tutor’s instructions include
? Constants vs literals. Using constants is important for the ease of maintenance.
Not using constants will result in lower marks. For example, in addition to Stage
1, consider constants for the default width and height of the text fields so as to
easily achieve a uniform look.
? GUI Design. Is it simple to use and easy to understand? Are all required
components there?
? Program code layout. Separate blocks of code by a blank line. Use comments.
? A comment is not an essay. Comments are important for the maintenance of a
program and should contain enough details, but keep them concise. Don’t
comment every single line.
? The program must have a prologue. Check style against the Java style guide
attached below (pp. last 4 pages).
? Good names for your variables and constants. Check style against the Java style
guide attached below (last 4 pages).
? Does the program work correctly? Are the elements drawn the right way?
Please refer to the Java Assignment Marking Feedback sheet for details on marks.
Step by Step Guide for Stage 2
1. 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.
2. Add to the same project that was used for Stage 1, a new Application Window
class (New ? Other ? WindowBuilder ? Swing Designer ? Application
Window) for your GUI.
(See below for a screenshot.)
3. As in the lectures, workshops and lab classes, give that Java application a suitable
name – Stage2 – (and optionally package name) of your choice.
A new JFrame object will be created and you should be able to switch between
the Java source code for it as well as the empty GUI in the WindowBuilder editor
in Eclipse.
4. Right-click on the grey area inside the JFrame and set the layout to “Absolute
layout”. (Note, this shows up as “null” layout in the source code.)
5. Adjust the size of the JFrame to a suitable size for your GUI.
6. Add all the components for your GUI. Use Java Swing components, which you
can add via the Palette in the WindowBuilder’s Design view. Make sure that the
names you use for these components comply with our Java Style Guide (see
below).
7. Add event handlers (ActionListeners) for your buttons, radio buttons, check
boxes, etc. To do so, in the GUI editor right-click on the element (say, a JButton)
and select Add event handler ? action ? actionPerformed. (Similar events may
be needed for your checkboxes, radio buttons, etc.)
8. Add the code that does the actions, e.g. that does the calculation of the average
daily rainfall for each month.
9. Reuse your code for the calculation Stage 1 by copying and pasting it from the
Stage 1 main method into the Calculate button’s event handler. Remember that
now your input comes from the GUI rather than the console, so remove the code
that reads the information from the console and replace it with code that reads the
information from the GUI.
10. Test your application! Run it as a Java Application. Enter the test cases listed
above and check if your program gives the same result.
11. Make sure your code adheres to the Java style guide. Check for prologue
comment and other comments in your code. You need to manually add more
comments than the automatically generated comments!
Stage 3
In Stage 3 of the assignment, the input will not come directly from the user any more, but
rather from a text file.
The file rainfall.txt contains the data from weather stations. Each line of this file contains
the weather data from a station for a given year. Each line consists of the station name,
year, and rainfall data, separated by semicolons. The rainfall data for each month consists
of a comma-separated list of values. The following is an example:
Sydney Botanical Gardens;1900;
43.7,39.1,109.2,151.9,319,282.7,326.9,12.4,64.8,2.5,187.7,44.5
You will need to copy rainfall.txt into the same directory of your Eclipse project
that holds the .project file. When marking, the details in the file may change, but the
structure will not.
Your task will be to add code to your program that reads the rainfall 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 weather station names & year to a JList object,
and allows the user to choose a weather station/year combination from this list.
Upon this selection, the program displays the weather station data for the currently
chosen station/year in text labels (JLabel) or text fields (JTextField), computes the
average daily rainfall for each month and displays the values in text labels and computes
the annual rainfall, then updates a drawing panel to display the rainfall data in a bar
graph like comparison. These are new componen …
Purchase answer to see full
attachment

GradeAcers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Order your essay today and save 15% with the discount code DISCOUNT15