logo

ITECH1000 Programming Assignment 2

   

Added on  2024-04-25

22 Pages2739 Words91 Views
 | 
 | 
 | 
ITECH1000
PROGRAMMING
ASSISSMENT 2
1
ITECH1000 Programming Assignment 2_1

Contents
Introduction................................................................................................................................4
Stage -1 Design Documentation.................................................................................................4
1.1 An algorithm that describes how the program will operate.............................................4
1.2 Logical structure of the program:.....................................................................................5
1.3: Test cases........................................................................................................................6
Stage 2: Program Development.................................................................................................7
Stage 3: Technical documentation(Implementation)...............................................................11
Reference..................................................................................................................................21
Appendix..................................................................................................................................22
List of Figures
Figure 1flow of application program.........................................................................................6
Figure 2 initializing Lawn moving championship.....................................................................7
Figure 3 number of rounds validation........................................................................................8
Figure 4 initializing race............................................................................................................8
Figure 5menu system.................................................................................................................9
Figure 6when select menu option1............................................................................................9
Figure 7when select menu option 2.........................................................................................10
Figure 8when select menu option3..........................................................................................10
Figure 9when select menu option 4.........................................................................................10
Figure 10 ID30340842.java (a)................................................................................................11
Figure 11 ID30340842.java (b)................................................................................................12
Figure 12 ID30340842.java (c)................................................................................................12
Figure 13 race class(a).............................................................................................................13
Figure 14race class(b)..............................................................................................................13
Figure 15 race class(c).............................................................................................................14
Figure 16 race class(d).............................................................................................................14
Figure 17 race class(e).............................................................................................................15
Figure 18 race class(f)..............................................................................................................15
2
ITECH1000 Programming Assignment 2_2

Figure 19 race class(g).............................................................................................................16
Figure 20 race class(h).............................................................................................................16
Figure 21 race class(i)..............................................................................................................17
Figure 22 Entry class(a)...........................................................................................................17
Figure 23 Entry class(b)...........................................................................................................18
Figure 24 competitor class.......................................................................................................18
Figure 25 LawnMower class....................................................................................................19
3
ITECH1000 Programming Assignment 2_3

Introduction
Here I am developing a java based program for “LAWN MOWING APPLICATION” which
is a race management system which will take competitors name, brand name, a number of
rounds, finish time as input and will provide result after some calculation as total finish time
and winners list after sorting.
Stage -1 Design Documentation.
1.1 An algorithm that describes how the program will operate.
The first step is to open the Java IDE that is “net beans” and create the new project name
ID30340842.
Moving to the next step I need to create the main class given in the assignment that is
“Driver” and create the package named ‘race game’.
Now I need to start the program by giving a short message as “Initializing lawn mowing
championship” and then “context administration system”.
Then program will take input from the user that how many rounds do competitors need to
complete, for taking the input we need to use scanner class and import it from util class.
Now I need to create race class containing some private variables that are No_of_rounds
(int), No_of_lawnmower_Brands (int), and one array named Entries. After this we need
to define some public methods named currentNumberOfCompetitors(int), registerEntry(),
displayResults(), sortResults() and some private methods having Boolean data type
capacityReached(String), sortResults(), entrantAlreadyRegistered(String),
lawnMowerBrandReached(String) and constructor named Race(int,int,int).
Now create another class named Entry class having private variables finish Time [] array
and competitor variable and further defining some public methods as
setFinishTime(int,double), getFinishTime(int), getCompetitors(), getTotal() and
constructor entry(competitor,int).
Now I am going to create my third class named competitor class and will declare some
private variable that is competitor name, a lawnmower with some private methods as
getName(), getLawnMoverDetails() and constructor with perimeters named
competitor(string, LawnMower).
Now I will create last class of this project as lawnMower and declare some private
variables in it as a manufacturer and engine size having string data type and some
4
ITECH1000 Programming Assignment 2_4

methods named getManufacturer(), getEngineSize() and the constructor
lawnMower(string, string).
After all the classes are created now I am going to connect all the classes to main driver
class using import package and further, I will call the methods of different classes by
making the object of each class.
After all the above steps are done I will test the project by executing it and entering some
sample details in it. If the project gives the desired output I will finally end the project.
If the project does not give the desired output then I will make the changes required and
will execute it again.
Class: it is the main part of the java. It is the base to start the java program. It is needed to
create a class to start with java programming. The
Object: it is the basic entity of oops programming environment. The object is created for
both methods and classes to inherit their property (Docs.oracle, 2017).
Variables: it is the name given to location so we can store some data given by the user as
well. Also, it is preferred to give the variable a meaningful name so that it could be easily
accessible and understandable.
Constructors: these are the methods defined as the same name as the class is defined.
When the object is created constructor is the one which is automatically called.
The method is a code block which can be invoked at any point of time and it is the
method in which we add the functionality to be executed.
Data types: it is the type of data that variable and method will take such as integer, float,
double, char, string and more.
1.2 Logical structure of the program:
5
ITECH1000 Programming Assignment 2_5

Figure 1flow of application program
1.3: Test cases
Test case Expected Result Actual result
1. At the start of the project,
small welcome message
should be displayed.
Message displaying
welcome message and
telling about the project
objective.
The message is displayed
successfully.
2.Number of rounds in
racing should be at least 2
and at most 5
It should give the prior
information about the
number of rounds
Information is given
successfully.
6
ITECH1000 Programming Assignment 2_6

End of preview

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

Related Documents