Recent Question/Assignment

Assessment Details and Submission Guidelines
Trimester T1 2018
Unit Code BN108/BN108D
Unit Title Programming for Networking
Assessment Type Individual
Assessment
Title Interactive programs
Purpose of the assessment
(with ULO
Mapping) This assignment assesses the basic concepts of programming; students should be able to demonstrate their achievements in the following unit learning outcomes:
a. describe the fundamental principles of object-oriented programming;
b. interpret a user’s needs while dealing with simple program specifications;
c. design a simple class using UML notation;
d. create a simple application based on UML design and the incremental development process of coding, debugging, and testing;
e. apply basic control structures – sequence, repetition, and selection – to program development;
f. produce simple interactive applications.
Weight 25%
Total Marks 50 marks
Word limit Not applicable
Due Date 30/05/2018 5:00PM
Submission Guidelines • All work must be submitted on Moodle by the due date along with a completed Assignment Cover Page.
• The assignment must be in MS Word format, 1.5 spacing, 11-pt Calibri (Body) font and 2 cm margins on all four sides of your page with appropriate section headings.
• Reference sources must be cited in the text of the report, and listed appropriately at the end in a reference list using IEEE referencing style.
Extension • If an extension of time to submit work is required, a Special Consideration Application must be submitted directly on AMS. You must submit this application three working days prior to the due date of the assignment.
Further information is available at:
http://www.mit.edu.au/about-mit/institute-publications/policiesprocedures-and-guidelines/specialconsiderationdeferment
Academic
Misconduct
• Academic Misconduct is a serious offence. Depending on the seriousness of the case, penalties can vary from a written warning or zero marks to exclusion from the course or rescinding the degree. Students should make themselves familiar with the full policy and procedure available at: http://www.mit.edu.au/about-mit/institute-publications/policiesprocedures-and-guidelines/Plagiarism-Academic-Misconduct-PolicyProcedure. For further information, please refer to the Academic Integrity Section in your Unit Description.
David Chisanga Moderated by: Dr Javed Ali Baloch November, 2017
Assignment Description
This assignment will give you practice with interactive programs, if/else statements, arrays, loops and methods.
Problem Description
A small car yard dealing in second hand cars needs an application to keep records of cars in stock. Details of each car shall include id (unique for each car), model, year of manufacturing, price paid for the car (i.e. purchase price) and selling price.
Selling price is calculated as old price plus mark-up of 30%. For example, Ford Transit bought for $20,000 will have the selling price of 20000 * (1 + 0.3) = 26000.
The car yard does not buy cars manufactured before 2009.
Task Requirements
Imagine you have been invited to develop a menu driven java application to manage records of cars in stock.
Familiarise yourself with the problem description provided above and complete the following tasks.
1. Develop a UML class diagram based on the problem description. The name of the class must be Car
a. Identify all the required attributes (includes id and selling price) for the Car class.
b. Identify a constructor for the class. Attributes id and selling price are calculated fields and should not be included as constructor parameters.
c. Identify all the set and get methods for each of the attributes identified in 1.a
2. Write a Java implementation of the UML diagram defined in 1. In your class, include comments describing the function of the class, the name of the programmer and the date of implementation.
3. Write a Java program (driver class) named CarYardMITnnnnn (nnnnn is your MIT ID) with a main method. Within the main method, design and implement the menu driven program functions of buying, selling, displaying and terminating the program as described below. Include comments describing the function of the program, the name of the programmer and the date of implementation.
a. Declare all required variables including the list of cars (arrays/ArrayList) as static variables.
b. Include static methods to implement buy, sell, and display functions
c. Populate the list of cars (arrays) on start-up with three car objects of your choice which should be displayed when user selects option three (3) from program Menu.
d. Program displays a main menu on execution and allows user to interact with the program until the user selects menu option four (4) which terminates the program.
Description of Program functions
Program displays a menu on execution. Four menu options are available to allow the user to buy a car, sell a car, display all cars, and exit program respectively. Program functionality and screen output for each of the menu option when selected by the user follows:
Program menu on execution:
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice (1-4):
Invalid menu choice: User enters 5
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice(1-4): 5
Invalid menu choice: 5
Buy a car (option 1): User enters 1. Note the error message for year before 2009
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice(1-4): 1
--- Buy Car ---
Enter model name:
Mazda
Enter Year:
2008
Error! The car yard does not buy cars manufactured before 2009.
Enter Year:
2009
Enter price: $
10000
New car added: Mazda (2009)
Sell a car (option 2): User enters 2. Note the error message for invalid car id
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice (1-4): 2
--- Car Details---
Enter Car id:
101
Model: Honda
Year: 2012
Purchase Price: $20000.0
Selling Price: $26000.0
--- Car Details---
Enter Car id:
99
No match found for car ID:99
Display all cars (option 3): User enters 3
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice (1-4): 3
--- Car List ---
1:
ID: 100
Model: Toyota
Year: 2009 Price: $10000.0
2:
ID: 101
Model: Honda
Year: 2012 Price: $20000.0
3:
ID: 102
Model: Subaru
Year: 2015
Price: $30000.0
Exit Program (option 4): User enters 4
~~~ Main Menu ~~~
1. Buy Car
2. Sell Car
3. Display all cars
4. Exit
Enter menu choice (1-4): 4
Terminating...
Prepared by: Umesh Poudel Moderated by: Dr Javed Ali Baloch May 2018
Marking criteria:
Marking criteria is shown in following table. Marks are allocated as follows:
Description of criteria Marks
Task 1: Develop a UML class diagram [5 marks]
Identify all the required attributes
2
Identify a constructor for the class
1
Identify all the set and get methods
2
Task 2: Write a Java implementation of the UML class diagram [10 marks]
Java class implementation consistent with the UML class model
10
Task 3: Write a Java program (driver class) [25 marks]
Declare all required variables as static variables
3
Include static methods to implement buy (4), sell (4), and display (4) functions. Screen outputs consistent with the samples provided
12
Program displays a main menu and is interactive. 5
Implements a loop to allow the program to continue running until the user quits
5
Others [10 marks]
Use whitespace properly to make program more readable, such as between operators and their operands, between parameters, and blank lines between groups of statements or methods.
2
Give meaningful names to methods and variables in your code.
2
Your program compiles successfully without any errors
4
Includes comments described in the program description
2
Total
50
Prepared by: Umesh Poudel Moderated by: Dr Javed Ali Baloch May 2018
Marking Rubric for Assignment #: Total Marks 50
Grade Mark HD
40-50 DI
35-44 CR
30-34 P
25-29 Fail 25
Excellent Very Good Good Satisfactory Unsatisfactory
Task1
/5 UML class diagram is well done and is consistent with the requirements. UML class diagram is consistent with the requirements Generally consistent with the requirements but can improve UML class diagram misses some requirements Not attempted or design effort is incorrect
Task 2
/10 Java implementation of the UML class diagram is well done and consistent with the UML model Java implementati on of the UML class diagram is mostly well done. Java implementati on of the UML class diagram is good and mostly consistent with the UML model Java implementation of the UML class diagram misses some design elements from the UML model Not attempted or implementation is incorrect
Task 3
/25 Driver class: design and implementation is well done and consistent with the task requirements. Driver class: design and
implementati
on is consistent with the task
requirements
. Driver class: design and implementati on is mostly consistent with the task requirements Driver class: design and implementation misses some task requirements No attempted or implementation is incorrect
Others
/10 Code layout, comments, meaningful variable names & compilation: well done and consistent with the requirements Code layout, comments, meaningful variable names & compilation: very good and consistent with the requirements Code layout, comments, meaningful variable names & compilation: generally consistent but can improve Code layout, comments, meaningful variable names & compilation: Some
inconsistencies with the requirements Code layout, comments, meaningful variable names & compilation: poor effort and program fails to compile
Prepared by: Umesh Poudel Moderated by: Dr Javed Ali Baloch May 2018

Looking for answers ?