top of page

Java Programming Assignment Help | Hire Advance Java Programming Expert

The questions for this part are based on generating and displaying some scores for games of Australian Rules Football. Games of football are scored based on “goals” and “behinds” . The points are summed to determine the winner.


Create a new NetBeans 8.2 Java project called Part2 and add the following starter code in a class called FootballScores


The following questions for this part either ask you to define a helper class, read or write football scores in a text file, or consider how the solution could be extended for binary files.


Question 2

Add a class called FootballGame to your Part2 project and implement it based on the following class diagram:












The key methods are described as follows:

summarize(): Calculates the winner of the game. Prints a message reporting whether the home team won, lost, or tied the game. Example output formats:

  • Round 1: Home team won 26 points to 20.

  • Round 2: Home team lost 8 points to 33.

  • Round 3: Match was tied 42 points each.


toString(): Gives a comma separated values (CSV) representation of the football game details:

  • roundNumber,homeGoals,homeBehinds,awayGoals,awayBehinds


Question 3

Complete the body of the writeTextScores() method from the FootballScores class provided in the starter code. This method will randomly generate the scores of NUM_ROUNDS football games. Each goal and behind score is a randomly generated number that must be at least 0 and less than MAX_SHOTS. The scores are written to the file represented by the TEXT_FILEconstant. Each line of the file will be in the format from the toString() method in the FootballGameclass.


Question 4

Complete the body of the printTextScores() method from the FootballScores class provided in the starter code. This method reads the scores from the TEXT_FILE file for one game at a time. For each game, the data is converted back to a FootballGame object and the result of the game is printed to the console using the summarise() method. (Hint: You can use the split() method of the String class to convert CSV data to tokens.)


Question 5

Consider hypothetically the work required to convert your solutions in questions 3-4 to use a binary file rather than a text file. Add a multilinejava comment at the end of your FootballScores class with written answers to the following questions:


a) What change would you need to make to the FootballGame class?

b) Which Java 8 API class would you use to write football scores to a binaryfile?

c) Which Java 8 API class would you use to read football scores from a binaryfile?

d) Briefly describe a technique to make sure you do not exceed the end of the file when reading a binary file?




PART 3 – Questions about Inheritance and Polymorphism

The questions for this part are based on an organisation that manages vehicleregistrations. Vehicle registrations are made up of the owner name (“name”), vehicle registration number (“regNum”), location (one of inner metropolitan, outer metropolitan, or regional) and the engine capacity of motorcycles if relevant (“engCapacity”, measured in “cc”, which is cubic centimeters).


Here are the registration fees that are charged for an annual registration:


The questions are also based on the following class diagram:















Create a new NetBeans 8.2 Java project called Part3 and complete the following questions.


Question 6 Implement the Vehicle class in your Part3 project as per the problem description and UML class diagram above. Some points to highlight are:

  • The Vehicle class is an abstract class.

  • The Location enumeration is defined inside the Vehicle class, as indicated by .

  • The “location” member is additional to the “Location” enumeration.

  • The calcRegFee() method (for calculating registration fees) is an abstractmethod.

  • The toString() method provides a short summary of the member fields.

  • You need to interpret the remainder yourself from the problem statement and UML.

Question 7

Implement the Car class in your Part3 project as per the problem description and UML class diagram above. Some points to highlight are:

  • The Car class extends the Vehicle class.

  • The calcRegFee() method overrides the version in the parent class.

  • Members inherited (but not overridden) are not repeated in the UML diagram.

  • You need to interpret the remainder yourself from the problem statement and UML.

Question 8

Implement the Motorcycleclass in your Part3 projectas per the problem description and UML class diagram above. Some points to highlight are:

  • The Motorcycle class also extends the Vehicle class.

  • The calcRegFee() method also overrides the version in the parent class.

  • The toString() method is overridden to additionally report the enginecapacity.

  • Members inherited (but not overridden) are not repeated in the UML diagram.

  • You need to interpret the remainder yourself from the problem statement and UML.

Question 9

Implement the RegistrationTester class in your Part3 projectto test the other classes.It will perform the following 4 tasks in the main() method:

  • Instantiate an array of type Vehicle and length 4.

  • Initialise the elements of the array with the followingvehicles

  • Write a loop that prints the details of each Car in the array and the registration fee.

  • Write a loop that prints the details of each Motorcycle in the array and the registration fee.




We are providing all Basic, Intermediate and Advance level java programming help. If you are looking to hire expert which can do your coursework, project and assignment which is related to java then send your requirement details at:


realcode4you@gmail.com

If you are looking the solution of above problems then also contact us and get solutions in affordable price.

Comments


bottom of page