logo

JAVA ASSIGNMENT

18 Pages1844 Words391 Views
   

Added on  2024-04-11

About This Document

This assignment focuses on the development of a Christmas Parcel Delivery System using Java programming. It includes design documentation, algorithm development, program development with base and advanced functionalities, testing, and references to external resources.

JAVA ASSIGNMENT

   Added on 2024-04-11

ShareRelated Documents
JAVA ASSIGNMENT
JAVA ASSIGNMENT_1
Contents
Stage 1: Design Documentation..................................................................................................................2
Algorithm development describing the function of the program.............................................................2
Flow Diagram:.....................................................................................................................................4
Documented test cases to validate program:............................................................................................4
Stage 2: Program Development...................................................................................................................6
Base Functionality:..................................................................................................................................6
Standard Functionality...........................................................................................................................11
Advanced Functionalities......................................................................................................................14
Stage 3: Testing.........................................................................................................................................15
References.................................................................................................................................................17
List of figures:
Figure 1 Flow Diagram of the system..........................................................................................................4
Figure 2 Welcome message code.................................................................................................................6
Figure 3 Welcome message output..............................................................................................................6
Figure 4 Menu Display code........................................................................................................................7
Figure 5 Menu Display output.....................................................................................................................7
Figure 6 Transport costs code......................................................................................................................8
Figure 7 Transport costs output...................................................................................................................8
Figure 8 Parcel details code.........................................................................................................................9
Figure 9 Parcel details output......................................................................................................................9
Figure 10 Parcel Delivery costs code.........................................................................................................10
Figure 11 Parcel Delivery costs output......................................................................................................10
Figure 12 Exit message display output......................................................................................................11
Figure 13 Coding conventions...................................................................................................................11
Figure 14 Module: Main............................................................................................................................12
Figure 15 Module: Setup_Cost_Per_KM..................................................................................................12
Figure 16 Module: EnterParcel..................................................................................................................13
Figure 17 Module: Display_Parcel_delivery_Costs..................................................................................13
Figure 18 Advanced functionality output..................................................................................................14
Figure 19 Advanced Functionality code....................................................................................................14
1
JAVA ASSIGNMENT_2
Stage 1: Design Documentation
Algorithm development describing the function of the program
The Christmas Parcel Delivery system is basically a Christmas parcel Delivery Calculator which
calculates the travel surcharge. The details of the parcel, the distance of the parcel to send and the
transportation cost per km is taken as an input from the user. Various operations and calculations are then
done on the input and the final delivery cost is displayed to the user.
An algorithm is defined as the set of steps describing the solution for a specific problem of the system.
Before starting with the coding part, I first designed the algorithm for the system to be designed keeping
in mind all the requirements of the system. The designed algorithm helped me a lot while the
development of the system. It helped me to be clear in the coding and helped in developing the code for
the system faster (Vogella, 2016).
Algorithm:
1) Display the welcome message for the Christmas Parcel Delivery System.
2) Loop: while (true) //to repeat the menu each time the user select and choice and choice gets
completed
3) Display the main menu having 4 choices.
4) Read the user input for the choice from the main menu.
5) If(user choice == 1) then
6) Reads the user input for cost per km for a package to be sent 100km or less.
7) Read the user input for cost per km for a package to be sent over 100km.
8) Display and store the user input.
9) End if
10) Else If(user choice == 2) then
11) Read the user input for receiver’s name.
12) Read user input for the weight of the parcel.
13) Read user choice for insurance(y/n)
14) Read user input for distance of the parcel to be send
15) Display and store the user input.
16) End else if
17) Else if (user choice == 3) then
18) If(distance of the parcel <= 100) then
19) Calculate transportation cost = (distance of the parcel to be sent)*(cost per km for 100km or less)
2
JAVA ASSIGNMENT_3
20) Else
21) Calculate transportation cost = (distance of the parcel to be send)*(cost per km for distance over
100km)
22) End if
23) If(Insurance choice == (‘Y’ | ‘y’)) then
24) Calculate Insurance cost = weight of parcel * 0.53
25) End if
26) Calculate total cost = transportation cost + Insurance cost
27) Display the calculated transportation cost, insurance cost and total cost to the user.
28) End else if
29) Else if(choice == 4) then
30) Display the thank you message
31) Exit from the system
32) End else if
33) End while
3
JAVA ASSIGNMENT_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
JAVA ASSIGNMENT
|18
|1830
|69

JAVA ASSIGNMENT
|18
|1815
|327

Christmas Parcel Delivery System
|1
|1256
|95

Fundamentals of Operating Systems and Java Programming
|14
|857
|463

Document Related to JAVA Programming
|15
|1971
|338

Programming in Java Assignment
|15
|2137
|33