CSCP1014 PROGRAMMING 1 Spring 2022
100 marks & 15% of coursework
1. Purpose of assignment
Create a menu-driven console-based Java program for a parcel delivery company to maintain the company's daily sales and calculate the dispatchers' daily payroll.
i. XXX (you may give a name to the company) is a parcel delivery company that helps its customers to send their documents/products/orders within Selangor state.
ii. The company has 3 part-time dispatchers.
iii. Each dispatcher can only deliver a maximum of 15 orders per day.
iv. The company divides the Selangor state into 2 zones, named Zone A and Zone B.
v. The delivery fee is calculated based on the total weight of the order, not the number of parcels in the order.
vi. Table 1 below shows the minimum fee per order.
vii. The user needs to pay an additional RM1 for every additional 100g.
viii. The parcel weight will be rounded up to the nearest 100g.
ix. The following shows 2 calculation examples:
o Parcel weight=252g deliver from Zone A to Zone A
Delivery fee = RM6 (first 100g) + RM2 (additional 152g) = RM8
o parcel weight=330g, deliver from Zone B to Zone A
Delivery fee = RM7 (first 100g) + RM3 (additional 230 gram) = RM10
x. The dispatcher will earn RM3 per order with an extra 5% commission if he has more than 10 orders for the day. The calculation for the commission is,
commission = 5% * total order amount.
Zone A -> Zone A Zone B -> Zone B
Zone A -> Zone B Zone B -> Zone A
AMERICAN DEGREE TRANSFER PROGRAM SUNWAY UNIVERSITY
i. Develop a menu-driven Java program for the XXX company to maintain its daily sales.
ii. The company's administrative staff is the only person to use the program. No login
module and no permanent storage are required to store the data. Instead, the program will
be restarted every day.
iii. The program must have minimum 2 arrays:
1. An array initialized with 3 part-time dispatchers' names.
2. A two-dimensions array of size 3*15 stores the orders' charges for the 3
iv. The program has a method to display the main menu with 4 options, add a new order, modify an order, view all orders, and exit. Once the user has completed the selected operation, the program will continuously loop back to this main menu method until the user chooses the Exit option to exit the program.
v. A method to perform the enter new order option
- The user will select a dispatcher, from-zone, the to-zone, and enter the total order weight.
- The program must validate all input values and allow the user to re-enter if invalid.
- If the chosen dispatcher has reached the maximum number of parcels for the day, the user needs to re-select another available dispatcher.
- Once all the input values are entered, the program will calculate and record the package charges into the orders array.
- A new order number is to be generated. It comprises the despatchers array’s index number, the order's index number, the from-area, and the to-area.
Example: order number = 10221 means it is the third order for the second despatcher and delivery from area 2 to area 1. 10221 despatcher order from to index no index no area area
- The program will then display the order no, the dispatcher's name (retrieved from the array), the from-zone, to-zone, and total charges on the screen.
vi. A method to perform the modify an order option
- The program will prompt the user to enter an order number.
- The program will validate if the order number exists. If it exists, it will display the order information on the screen, such as the order number, the dispatcher's name, the from zone, to zone, and the total charges.
- The program will then prompt the user to enter a new weight.
- The program will re-calculate the new delivery fee. If the new delivery fee is less than the existing fee, the program will display the refunding amount; otherwise, the program will display the top-up amount.
- After that, the program will update the respective array and return to the main menu.
A method to perform the display of all orders option
a. The program will display all orders for the day, as shown below. All the data should be retrieved from respective arrays using loops.
XXX delivery company daily report for 30Nov 2022
Dispatcher XXX YYY ZZZZ Total
Order 1 5 … ….
Order 2 6 … ….
Order 3 10 … …
: : … …
Total no of orders 12 … … XX
Gross wages 36.00 … … XX
Commission 2.10 … … XX
Total wages 38.10 … … XX
The main method should ONLY have statements to execute the method that will display the main menu.
There must be at least FOUR methods in the program to handle the required operations. You can add any additional methods to your program.
All the dispatcher's names and the order's fee must retrieve from the respective arrays. You must decide what values should declare as instance variables and what values to remain as the local variables in respective methods.
3. Due date and criteria
This assessment's due date is 22 November 2020 (Tuesday) at 2 pm.
Soft copy: upload the soft copies files through the e-learn link:
a) Name the class with the main method as Assignment2A_yourname.java, and compress the src folder into 1 .zip/.tar file.
d) Capture 10 sample output screens with/without an error message(s) in 1 .pdf file