首页 > > 详细

讲解COSC1073 Programming 1

RMIT Classification: Trusted
COSC1073 Programming 1, Semester 1 2022
Week 10 Assessment
Create two classes: Vehicle and UnmannedVehicle. The class UnmannedVehicle is a
subclass that extends the class Vehicle.
You are also required to write the driver class VehicleInformation, which allows you to
test your implementation of Vehicle and UnmannedVehicle.
The following are implementation details for the classes you need to implement (provided
when not self-evident):
• Vehicle class
o Private fields
§ String vehicleName
§ String vehicleManufacturer
§ int yearBuilt
§ int cost
o Public class constant field
§ int MINYEARBUILT equals to 1886 (as modern cars were invented in
1886)
o getter and setter methods depending on your program design
o void printInfo() method: Print out the information of the Vehicle, including its
name, manufacturer, year built, and cost. An example of the output of this
method is as follows:
Year built: 2021
Cost: 38000
Note: As shown in the above example output, starting from the second line,
each line has three spaces at the beginning.
• UnmannedVehicle class
o Extends the Vehicle class.
o Additional private fields: int SAE and int rating
§ SAE (level of automation) is between 0 and 5 and the rating between 0
and 10.
o Public class constant fields for min and max SAE and, min and max rating
o getter and setter methods depending on your program design
o Overrides the void printInfo() method of the superclass. The method not only
print out the information of name, manufacturer, year built, and cost, but also
print out the information about SAE and rating. An example of the output this
method is as follows.
Vehicle Information:
Name: Model Z
Page 2 of 5
RMIT Classification: Trusted
Manufacturer: Tesla
Year built: 2022
Cost: 88000
SAE: 3
Rating: 7
Your VehicleInformation.java would use Vehicle and UnmannedVehicle classes.
To do that, it has two methods Vehicle buildVehicle() and UnmannedVehicle
buildUnmannedVehicle() that validates the information before calling the
Vehicle/UnmannedVehicle constructor. Information to validate are builtYear, cost, SAE and
rating. These methods will return the object reference if successful, null otherwise.
Your main method should demonstrate the (tentative) creation of 2 unmanned and 2 regular
vehicles.
Below is the sample output.
Sample Output
Error: invalid yearBuilt. Object not created!
Vehicle Information:
Name: RAV4
Manufacturer: Toyota
Year built: 2021
Cost: 38000
Error: invalid sae. Object not created!
Vehicle Information:
Name: Model S
Manufacturer: Tesla
Year built: 2022
Cost: 80000
SAE: 2
Rating: 3
Another Sample Output
Vehicle Information:
Name: ZS
Manufacturer: MG
Year built: 2018
Cost: 35000
Vehicle Information:
Name: RAV4
Page 3 of 5
RMIT Classification: Trusted
Manufacturer: Toyota
Year built: 2021
Cost: 38000
Vehicle Information:
Name: AutoLab
Manufacturer: RMIT
Year built: 2002
Cost: 198000
SAE: 5
Rating: 9
Vehicle Information:
Name: R1T
Manufacturer: Rivian
Year built: 2022
Cost: 90000
SAE: 4
Rating: 8
Marking Guide
Zero marks if the java program cannot be compiled or is not JAVA8
compliant.
0 / 10
Implementation of the Vehicle class [2 marks]
Correctly declare the class, including the constructor 1 mark
Correctly implemented method printInfo() 1 mark
Implementation of the UnmannedVehicle class [2 marks]
Correctly declare the class, including the constructor 1 mark
Correctly implemented method printInfo() 1 mark
The main method, including printing the result in correct format [4 marks]
Objects are correctly constructed, methods are properly called 1 mark
Check invalid instance variable values 2 mark
Info are correctly printed 1 mark
Coding style: [2 marks]
Page 4 of 5
RMIT Classification: Trusted
No duplicate codes (segments with overlap of >≈ 3 lines) 0.5 mark
Proper use of whitespace, including indentation 0.5 mark
Proper use of comments 0.5 mark
Proper names of methods and variables 0.5 mark
Total (50% mark deduction if the program crashes during a normal run) [-5 marks]
Late penalty: 10% per day, up to 5 days [*0.9-0.5]
Submission Instructions
Export the project as an archive; the file name should be the same as the project name, for
example s1234567_Week9.zip and submit the zip file to Canvas under Assignments.
To export a project as a zip file in IntelliJ, click File -> Export -> Project to zip file.
Academic Integrity and Plagiarism (Standard RMIT Warning)
Your code will be automatically checked for similarity against other submissions so please
make sure your submitted project is entirely your own work.
Academic integrity is about honest presentation of your academic work. It means
acknowledging the work of others while developing your own insights, knowledge, and ideas.
You should take extreme care that you have:
• Acknowledged words, data, diagrams, models, frameworks and / or ideas of others
you have quoted (i.e., directly copied), summarised, paraphrased, discussed, or
mentioned in your assessment through the appropriate referencing methods.
• Provided a reference list of the publication details so your reader can locate the source
if necessary. This includes material taken from internet sites.
If you do not acknowledge the sources of your material, you may be accused of plagiarism
because you have passed off the work and ideas of another person without appropriate
referencing, as if they were your own.
RMIT University treats plagiarism as a very serious offence constituting misconduct.
Plagiarism covers a variety of inappropriate behaviours, including:
• Failure to properly document a source.
• Copyright material from the internet or databases.
• Collusion between students.
For further information on our policies and procedures, please refer to the University website.
Assessment Declaration
When you submit your project electronically, you agree to the RMIT Assessment Declaration.
Page 5 of 5
RMIT Classification: Trusted

联系我们 - QQ: 99515681 微信:codinghelp
© 2021 www.7daixie.com
程序辅导网!