Application of programming in java

Assignment Help JAVA Programming
Reference no: EM132314706

Abstract

This subject covers problem-solving, computer program design, implementation and evaluation in Java. Students learn to develop object-oriented applications consisting of a number of classes. The object-oriented approach is compared with other programming paradigms. The subject covers class design, file manipulation, Graphical User Interface components, and the use of inheritance and aggregation techniques.

Learning outcomes

Upon successful completion of this subject, students should:
• be able to design and implement algorithms in Java;
• be able to interpret and evaluate design requirements expressed in Unified Modelling Language (UML);
• be able to apply inheritance and aggregation patterns in the design and implementation of programs;
• be able to use object-oriented techniques and Java resources to develop small applications consisting of a number of classes;
• be able to apply testing and debugging techniques in program development;
• be able to compare and critically evaluate different programming paradigms;
• be able to manipulate file operations through Java programming;
• be able to implement Graphical User Interface (GUI) components using Java.

Assessment 1 - Basic Algorithms in Java

Task 1

The Australian Government will introduce a new personal income tax for 2018-2019. The personal income tax is calculated based on filing status and taxable income. There are four filing statuses: single filers, married filing jointly, married filing separately, and head of household. The tax rates vary every year. The following table shows the rates for 2018-2019. If you are, say, single with a taxable income of $10,000, the first $8,350 is taxed at 10% and the other $1,650 is taxed at 15%. So, your tax is $1,082.5.

Table 208-2019 Personal Tax Rates

Marginal Tax Rate

Single

Married Filing Jointly or Qualified Widow(er)

Married Filing Separately

Head of Household

10%

$0 - $8,350

$0 - $16,700

$0 - $8,350

$0 - $11,950

15%

$8,351- $33,950

$16,701 - $67,900

$8,351 - $33,950

$11,951 -

$45,500

25%

$33,951 -

$82,250

$67,901 - $137,050

$33,951 -

$68,525

$45,501 -

$117,450

28%

$82,251 -

$171,550

$137,051 - $208,850

$68,526 -

$104,425

$117,451 -

$190,200

33%

$171,551 -

$372,950

$208,851 - $372,950

$104,426 -

$186,475

$190,201 -

$372,950

35%

$372,951+

$372,951+

$186,476+

$372,951+

You need to write a program to compute the personal income tax. Your program should prompt the user to enter the filing status and taxable income and compute the tax. Enter 0 for single filers, 1 for married filing jointly, 2 for married filing separately, and 3 for head of household.

Task 2

Problem Description:

Write a Java program to solve the problem presented below. You may assume that the user will always enter valid data; you do not have to perform data validation.

The entry charges to a zoo are:

Children 5 years old and younger: free
Accompanied children from 6 to 15 years old: $2 each Unaccompanied children from 6 to 15 years old: $5 each Adults from 16 to 59 years old: $10 each
Seniors from 60 years and older: $8 each
An accompanied child is defined as one in a family group accompanied by an adult or a senior. An adult or senior can only count as accompanying one child from 6 to 15 years old. No limit is placed on the number of children 5 years old and younger, which is perhaps a failing on the part of the zoo authorities, but simplifies your problem. Ages are integers.
Your program will calculate and display the entry charge for each family group and also display the total takings for a sequence of groups. In this process it will correctly determine the number of accompanied children and those not counted as accompanied in each family group. It will request the user to enter the number of children (6 - 15 years old), the number of adults (16 - 59 years old) and the number of seniors (60+ years old) for each group, and it will display the entry charge for each group.
The following shows a sample run. Enter a group? (Yes=1/No=0): 1
Enter the number of children (age 6-15): 5
Enter the number of adults (age 16-59): 2 Enter the number of seniors (age 60+): 1 Total entry charge is $44
Enter a group? (Yes=1/No=0): 1
Enter the number of children (age 6-15): 1 Enter the number of adults (age 16-59): 2 Enter the number of seniors (age 60+): 0 Total entry charge is $22
Enter a group? (Yes=1/No=0): 0 Total takings: $66

You need to submit java and class files, a short discussion to explain the logic on how the problem has been solved, and sample output (for detail please see marking guide and presentation below).

Assessment item 2 - Designing Object-Oriented Program

Task 1

For this task you will create a class containing a number of static methods for processing an array of marks, which are scores in a test. Each mark is an integer in the range 0 to 100 inclusive. On the Interact site for this subject, you will be provided with a class Marks, which has a method getMarks that returns an array of marks for you to use in testing.The class ProcessMarks that you create will have the methods specified below. Most will accept an array of marks as an argument; one will accept an array of characters. The return type should be appropriate for the returned value.

• The max, min and range methods will return the maximum mark, the minimum mark and the difference between the maximum and minimum marks respectively.
• The mean methods will return the mean of the set of marks.
• The median method will return the median value of the set of marks. The median value is the middle one when the values are placed in order. To obtain an ordered version of the marks you may use an appropriate sort method of the Java API's Arrays class. Be careful not to destroy the original array of marks. If there is an even number of marks, the middle value is taken as the average of the two values that are nearest to the middle.
• The mode method will return the mode of the set of marks, which is the most commonly occurring mark. To find the mode, use an ordered version of the set of marks, as used for finding the median. If there is more than one value that is most common, any one of the most common values will do for the mode.
• The grades method will return an array of characters, which are the grades corresponding to the integer marks in the array of marks. The grades are to be assigned using the following lower boundaries for the corresponding marks: for grade A, the lower boundary is 90; for grade B, it is 75; for grade C, it is 60; for grade D, it is 50; for grade E, it is 45; and F is the grade for all other marks. A best solution for this method would not have the values for the lower boundaries hardcoded but would use an array for these values, which would allow the grade boundaries to be altered.
• The gradeDistn method will accept an array of characters, which are the grades assigned for the array of marks, such as returned by the grades method. The gradeDistn method will return an array of integer values containing the distribution of grades, which is the number of occurrences of each grade in the assigned grades. The characters used for grades are fixed. The returned array should provide the distribution in order from grade A to grade F.

The following points should be taken into account in the design of your program:
• None of your code should change the contents of the original array of marks.
• You should not make any assumption that client code, that would use your methods, should call them in any particular order. That is, you should not assume that a client that calls the range method will have previously called the max and min methods.

Test your ProcessMarks class, either by providing test code in a main method within that class or in a separate class. The test code will use an array of marks obtained from the getMarks method of the Marks class provided on the Interact site. Test each one of the methods described above, displaying the results appropriately. The grades should be displayed 30 per line with a space separator between grades. The grade distribution should be displayed in the form: A: 10
B: 30
C: 105
D: 75
E: 35F: 10

You need to submit java and class files, a short discussion to explain the logic on how the problem has been solved, and sample output (for detail please see marking guide and presentation below).

Task 2

For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. You need to draw a UML diagram for the class (Point3D) and then implement the class.

The Point3D class will have the following state and functionality:

• Three data fields, x, y and z, of type double, represent the point's coordinates
• Additional data field, colour, of type String, represents the point's color
• A no-arg constructor creates a point at position (0, 0, 0) and "Red" colour.

• Another constructor creates a point with specified coordinates and colour.
• A getter method is provided for each of the fields.
• An accessor method named distance returns the distance between the current point and another point passed as an argument.
• The distance method is overloaded to accept the coordinates of the other point.

Write a TestPoint3D class that will have a main method, and perhaps other methods as required by good design, to test your Point3D class. It will not have user input because this class will stand as a record of the tests you have applied and you will be able to run it whenever you alter your Point3D class. For the TestPoint3D class you will need to do the following:

• Test the basic state and functionality of the Point3D class. Each of the constructors and each of the methods should be tested using some different data values. The test code should display values so that they can be checked.
• Write some code to create an array of at least 10 Point3D objects.
• Write a method max, which will accept the array of points as an argument, and will calculate and display the maximum distance between the points in the array, and the pair of points for which the maximum occurs.
• Write a method min, which will accept the array of points as an argument, and will calculate and display the minimum distance between the points in the array, and the pair of points for which the minimum occurs.

Presentation

Material to submit for task 1 and Task 2
You need to submit a single zip file containing:
1. All java and class files
2. A doc/pdf file (not more than 500 words) with the description of the problems including input and output in your own words, description of how you test this program with explaining logic, a snapshot of the program output, and UML design (where required, see marking guide)

Assessment item 3 - Application of Programming in Java

Task 1

For this task you will create a Subject class, whose instances will represent the subjects for study at a university. A subject will have a name, just a String, and a subject code, which is a six-character String. The first three characters of a subject code are alphabetic and the last three are numeric. The first three characters define the subject's discipline area. A subject code must be unique.

You will also write a TestSubject class to test the use of your Subject class. In particular this will maintain an array of subjects. In order to manage the uniqueness of the subject codes, your program will need to display information about existing subject codes as well as checking that any new subject code supplied by the user is not the same as any existing subject code.
The following state and functionality should be provided for the Subject class:

• Two fields will hold the subject's name and the six-character subject code.
• A constructor will allow a name and a new, validated subject code to be provided when a new subject is created.
• Getters will provide access to the attributes.
• An accessor method called getDiscipline will return a string containing the first three characters of the subject code.

• Another accessor method called codeMatches will return a boolean value indicating if the subject's code matches the string argument provided. "Matches" is used here in the same sense as for the matches method of the String class.
• A toString method will return a string containing the subject code and subject name.
To assist with managing subject codes and their uniqueness you will provide the Subject class with some class methods as follows:

• An allDisciplines method will accept an array of Subject objects. It will return an array containing the different 3-character discipline codes represented in the array of subjects in alphabetically order.
• A codesPerDiscipline method will accept an array of Subject objects and a 3-character discipline code. It will return an array containing the different subject codes represented in the array of subjects for the particular discipline.
• An isValidCode method will accept a string that is a possible new subject code, and return a boolean indicating whether it satisfies the structural requirements for a subject code.
• A codeExists method will accept an array of Subject objects and a possible new subject code. It will return a boolean indicating whether that code has already been allocated to one of the subjects in the array.
• A sortDisciplines method will accept an array of Subjects objects. It will return the sorted array of subjects in alphabetically order.

Your TestSubject program will perform the following sequence of actions, using good design techniques such as in the appropriate use of methods:
• An initial array of Subject objects will be created from any data in a file that was previously saved by the program. You need to read those data from the file and process other requirements (see below)
• The user interaction will then proceed to allow the user to add one or more new subjects to the array. If the user wishes to add new subjects, the discipline areas of existing subjects should be displayed in alphabetically order. The user will then enter a discipline code to which the program will respond by displaying any existing subject codes in that discipline. This procedure simplifies the user's task of choosing subject codes that do not already exist, but does not prevent user mistake. Each subject code entered by the user should be checked. The user can enter any new subjects in that discipline (or indeed in other disciplines). The user should be given the choice of repeating the processing for other discipline areas.
• When the user has finished adding subjects, and only if subjects have indeed been added, the program will overwrite the data file with the updated data.

Note:

• You may use an ArrayList to implement an array if you prefer and it is appropriate.

You need to submit java and class files, a short discussion to explain the logic on how the problem has been solved, and sample output (for detail please see marking guide and presentation below).

Task 2

Value:

Design a class named Triangle that extends GeometricObject class (see GeometricObject class in the textbook). The Triangle class contains:
• Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle.
• A no-arg constructor that creates a default triangle.
• A constructor that creates a triangle with the specified side1, side2, and side3.
• The accessor methods for all three data fields.
• A method named getArea() that returns the area of this triangle.
• A method named getPerimeter() that returns the perimeter of this triangle.
• A method named toString() that returns a string description for the triangle.

The formula to compute the area of a triangle is:

s = (side1 + side2 + side3)/2;

area = √s(s-side1)x(s-side2)x(s-side3)

The toString() method should return all side information.

Draw the UML diagram that involves the class Triangle. Implement the class. Write a test program that creates a Triangle object with sides 3.0, 4.0, 5.0, color yellow and filled true, and displays the area, perimeter, color, and whether filled or not. GeometricObject class is given below.

You need to submit java and class files, a short discussion to explain the logic on how the problem has been solved, UML diagram, and sample output (for detail please see marking guide and presentation below).

Task 3:

Write a Java program using JavaFX that displays nine playing cards. In the first row display three playing cards (randomly selected from the first 52 cards). In the second row, display three Joker Cards (can be same) with 45 degree, 90 degree and 135 degree angles respectively. In the third row display three any Card (must be different themselves) with 135, 90 and 45 degrees respectively.

The image icons used in the questions are available in the Resource folder of Interact2. You may need to use HBox and/or VBox Pane.

Task 4:

Investigate the imperative programming paradigm, as exemplified by procedural programming and object-oriented programming, and the declarative programming paradigm, as exemplified by functional programming and logic programming.

The Reading from Brookshear, 2012 will form a starting point for your investigation but you need to do research using different sources such as websites, books, journals and/or conference papers. For further investigation, remember that you should not reference Wikipedia items in an essay, so make sure to find articles that you can reference.

Write an essay, of approximately 800 words, based on your investigation, which provides answers to the following questions:

- What are the essential differences between the paradigms?
- What are some of the programming languages used for these different paradigms?
- What specific advantages are provided by these different programming approaches?

Your essay should be referenced using the APA referencing style.

Attachment:- Programming in Java.rar

Reference no: EM132314706

Questions Cloud

Write Business Report on Bank of America : Write 2 pages Business Report on Bank of America. In the report include the following points - 1. Introduction 2. Body 3. Conclusion
Configure the server as required by technical requirements : ICTSUS501 Implement Server Virtualisation for a Sustainable ICT System-Macquarie University-Australia-Identify product and vendor architecture and equipment.
What does swot stand for : BSBWOR501 Manage Personal Work Priorities and Professional Development-Macquarie University-Australia- Develop an action plan to put strategies into action.
Explain how tata steels approaches to csr : Macquarie University-Australia-BSBSUS501 Develop Workplace Policy and Procedures for Sustainability-Explain how Tata Steel’s approaches to CSR and its priority.
Application of programming in java : ITC538 - Programming in Java - Charles Sturt University - Write a Java program to solve the problem presented below. You may assume that the user will always
Prepare a website proposal to mr richards : ICTWEB507 Customise a Complex ICT Content Management System -Macquarie University-Australia-Identify and download an appropriate open-source system.
Analyse requirements for internal and external security : ICTNWK529 Install and Manage Complex ICT Networks -Macquarie University-Australia-Analyse requirements for internal and external security.
Assess hardware requirements for the new os : ICTSAS518-Macquarie University-Australia-Install and Upgrade Operating Systems-Consult with your supervisor and finalise the OS required to be installed.
Prepare a cash flow statement for harrys harware : BUACC 5930-Accounting Concepts and Practices-Federation University Australia-Prepare a Cash Flow Statement for Harrys Harware for the year ended 30 June.

Reviews

len2314706

5/31/2019 4:44:35 AM

Presentation Material to submit for task 1 and Task 2 You need to submit a single zip file containing: 1. All java and class files 2. A doc/pdf file (not more than 500 words) with the description of the problems including input and output in your own words, description of how you test this program with explaining logic, a snapshot of the program output, and UML design (where required, see marking guide) Requirements To complete this assessment you might need to have covered material up to and including the topic Objects and Classes, Thinking in Objects, and Arrays in the Text Book and Topics.

len2314706

5/31/2019 4:44:26 AM

HD Provide java file and it executes without crashing towards intended output (up to 1.0) Implement and integrate the Point3D and TestPoint3Dclasses with all functions perfectly by maintaining logical flow (6) UML with all components and their modifier, argument, and return type (up to 1.5) Proper indentation and comments in each block and major lines (0.5) Provide discussion document within word limit proper explaining the logic how the problem has been solved, and a sample outputs for task (up to 1.0)

len2314706

5/31/2019 4:44:09 AM

HD Provide java file and it executes without crashing towards intended output (up to 1.0) Implement and integrate classes with all functions by maintaining logical flow (7) Maintain proper naming convention of all variables, proper indentation on each block/line of code(s), and provide inline comments (up to 0.5)

len2314706

5/31/2019 4:43:55 AM

Presentation Material to submit for Task 1 and Task 2: You need to submit a single zip file containing: 1. All java and class files 2. A doc/pdf file with a snapshot of the program output for at least two executions with explanation the logic on how you solve the problem (max 400 words) Requirements To complete this assignment you might need to have covered materials up to and including the topic Selection and Looping in the Text Book and Topics.

len2314706

5/31/2019 4:43:45 AM

HD Provide java file and it executes without crashing towards intended output (1.0) Execute and compute the correct entry charges with any input, proper java structure and logical flow (3.0)

len2314706

5/31/2019 4:43:30 AM

d. Submission: the documents with all 1.0 Provide no discussion Provide discussion Provide discussion Provide discussion components (java code and testing outputs). A short discussion to explain the logic on how the problem has been solved (200 words maximum). document but provide a sample output (other than the examples) for task (up to 0.5) document in very brief (well below the expected word limit) and provide a sample output (other than the examples) for task (up to 0.75) document within word limit but not enough explanation about the logic how the problem has been solved, and provide a sample output (other than the examples) for task (up to 0.85) document within word limit proper explaining the logic how the problem has been solved, and two sample outputs with different set of inputs (up to 1.0)

len2314706

5/31/2019 4:43:19 AM

c. Presentation: Code uses good style (identifier naming, indentation, header and inline comments) 1.0 Provide arbitrary variable names, no proper indentation, and very few comments (up to 0.5) Provide a number of variable names but not all by maintaining proper naming convention, occasionally proper indentation, and comments on only important operation (up to 0.75) Maintain proper naming convention of all variables, proper indentation on each block of codes, and provide comments on only important operation (up to 0.85) Maintain proper naming convention of all variables, proper indentation on each block/line of code(s), and provide inline comments (up to 1.0)

len2314706

5/31/2019 4:43:11 AM

b. Program design & implementation: An appropriate main method with the inputs, processing and outputs specified in the question 2.0 Execute and compute the tax correctly for some cases of the given examples (up to 1.0) Execute and compute the tax for all given examples correctly (up to 1.5) Execute and compute the correct tax with proper java structure and logical flow for any value with minor errors (up to 1.75) Execute and compute the correct tax with proper java structure and logical flow for any value (up to 2.0)

len2314706

5/31/2019 4:42:59 AM

Criteria a. Execution: Program launches, executes and terminates without crashing; program executes as specified. HD Provide java file and it executes without crashing towards intended output (up to 1.0)

Write a Review

JAVA Programming Questions & Answers

  Java implementations of bubble sort

The first project involves benchmarking the behavior of Java implementations of bubble sort, itinvolves writing the code to perform the benchmarking of the bubble sort algorithm.

  Create a java file named linesorter

Create a java file named LineSorter - You will write a program that will take the names of two text files as command line arguments

  Write a java application that allows a user to enter numbers

Write a Java application that allows a user to enter numbers into an array and then process them. Enter the number of elements and the value of each element

  Draw a uml diagram for the classes

Draw a UML diagram for the classes. Implement the classes, and write a test program that creates a salaried employee and two hourly employees.

  Write a program to read five integers and print their sum

Write a program in Java to read 5 integers and print their sum and average. Use loop statements in your code. What is value of m after running the given code?

  Name all the modifiers in java

Before the OOP was catching on, the methodology to solve a problem usually is to break down the task into subtasks.

  Given an aerodynamic body you have learned in aerodynamics

given an aerodynamic body you have learned in aerodynamics and flight mechanics how to apply the numerical source panel

  Create a very simple java program

Create a Java program with file name of greetings.java. Your program will provide a short introduction about yourself: name, the city you live in, hobbies etc

  Method to calculate all primes in the range [2..n]

One commonly used method to calculate all primes in the range [2..n] is to start with the number 2, mark it as prime, and mark all its multiples (excluding itself) as not prime. Then, we find the next smallest unmarked number, mark it as prime, and m..

  Make an explicit statement of the invariant of the set class

Write a new container class called ser, which is similar to a bag, except that a set can contain only one copy of any given item, You will need to change the interface a bit. For example, instead of the bag's count function, you'll want a constant..

  Implement open addressing to store hashed data

Implement Open Addressing to store hashed data. Use as keys the last names in the patient.txt file in Project 2

  Java application based on your pseudo code

Can somebody help me write out a pseudo code, and help me solve the following according to the pseudo code

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd