Recent Question/Assignment

There are 3 .java files and these are to be modified to get the desired results as put up in pdf copies.
University of Newcastle
School of Information and Physical Sciences
SENG6110 Programming Assignment 2 – Trimester 1, 2022
Due: Electronic submission (Canvas) by 11:59pm on Sunday 17 April 2022. Worth: 20%
Introduction
The objective of this assignment is to extend the implementation of Assignment 1 using arrays and external files.
This assignment must be completed individually.
Before you start
Carefully read the specification below. Make sure you have all the information necessary to start writing the program. If you are uncertain of something, do not make assumptions. Post your questions to the discussion board forum named -Assignment 2- and check it regularly.
Additional resources on Canvas which you can use as a starting point:
• Three .java files. Modify these files to answer the questions below. DO NOT re-name them or create additional .java files.
• A guide to answering the assignment is provided, giving additional explanation and help for each question.
Specifications
Create a database which will hold up to 2 region objects. Each region object may have up to 3 dwarf planets in it – see the sample data in the file “input_data.csv”. To implement this you should use arrays, one array of up to 2 region objects each with its own array of up to 3 dwarf planets as an attribute.
That is, create an array of up to 2 region objects. Each region object can have an array of up to 3 dwarf planet objects as one of its attributes.
The program should have the functionalities listed below.
Question 1. Add a region (15 marks).
The user will specify a) the region name, b) the width in AU and c) the population of objects with diameters greater than 100km. There should be an error message if the region name already exists in the array, or if there are already 2 region objects in the array.
Question 2. Add a dwarf planet object to one of the region objects (15 marks).
The user will specify the region name (the object to which this dwarf planet is being added), dwarf planet name, diameter (km), mass (x1021kg) and number of moons. There should be an error message if the dwarf planet already exists, or if the region does not exist, or the region already has 3
dwarf planet objects.
Question 3. Delete a region (15 marks).
The user will specify the region name. There should be an error message if the region does not exist. This will also cause any dwarf planet objects in that region to be deleted.
Question 4. Delete a dwarf planet (15 marks).
The user will specify the region and dwarf planet name. There should be an error message if either do not exist. If there exists a region containing that dwarf planet, the region should be updated.
Question 5. List all objects (15 marks).
The output should list all regions and dwarf planets with all attributes included. If there are no objects, the output should be: -No objects exist-. Otherwise, one line should be output for each object with one of these formats:
REGION name width largeObjects
DWARF PLANET regionName dwarfPlanetName diameter mass moons
Question 6. List the dwarf planets that belong in a region (5 marks).
The user will specify the region name. If the region contains no dwarf planet objects, the output should be: -No dwarf planets contained in this region.- Otherwise, one line should be output for each dwarf planet, with this format:
DWARF PLANET regionName dwarfPlanetName diameter mass moons
Question 7. List the dwarf planets with a mass greater than 4 x 1021kg (5 marks).
The output should be in the format:
DWARF PLANET regionName dwarfPlanetName mass
Question 8. List the dwarf planet with the smallest diameter in each region (5 marks). There should be an error message if there are no dwarf planets in the database. The output should be in the format:
DWARF PLANET regionName dwarfPlanetName diameter
Question 9. Import region and dwarf planet information from a file (5 marks). The user will specify the name of the file to be read from. The program should expect a file consisting of zero or more lines. Each line should have one of these formats:
REGION name width largeObjects
DWARF PLANET regionName dwarfPlanetName diameter mass moons
The imported data should replace any pre-existing objects. A REGION line in the input file should cause addition of the described region object. Similarly, a DWARF PLANET line should cause addition of the described dwarf planet. An error message should be output if the file is unable to be opened, or if a problem occurred during reading the file. This includes cases such as finding a line with an invalid format and being unable to add a region or dwarf planet due to one of the issues listed under functionalities 1 and 2 (in both cases, the program should continue to process the rest of the file). An example of a file which could be used (after the heading lines are removed) is included as input_data.csv.
Question 10. Write region and dwarf planet information to file (5 marks).
The user will specify the name of the file to create. The created file should have the same format as that used for importing. An error message should be output if the file is unable to be created, or if a problem occurred during writing.
Program Requirements
In this assignment you should use arrays to store the region and dwarf planet objects. Use two constants specifying array sizes.
The program should consist of three classes (and ONLY three classes). Use the supplied “files to start with”, do not change their names or add any additional files.
All instance variables of your classes should be private (this is imposed so that you apply the principles of encapsulation).
Your classes will need methods to provide the required functionalities. The only class which should have a main() method is Interface.java.
Marks will be awarded for layout (including visual aspects (variable names, indentation) and structural aspects (variable scope, method usage)), documentation (comments), and the submissions ability to perform as specified. A more detailed marking schema will be made available on Canvas.
What to submit
You should submit only the three .java files (Region.java, DwarfPlanet.java and Interface.java) in a compressed .zip file, via the -Assignment 2- link on Canvas. Do not include .class files in your submission.
Make sure that your name is in a comment block at the beginning of each .java file.
Late Penalty and adverse circumstances
Note that your mark will be reduced by 10% for each day (or part day) that the assignment is late. This applies equally to week and weekend days. You are entitled to apply for special consideration if adverse circumstances have had an impact on your performance in an assessment item. This includes applying for an extension of time to complete an assessment item. See https://www.newcastle.edu.au/current-students/learning/assessments-and-exams/adversecircumstances for more details.