0% found this document useful (0 votes)
68 views14 pages

Criterion C Development

The document describes several complex programming techniques used in the development of a program for a business owner named Jimena to manage her products and orders, including arrays, complex selection (nested if statements), graphic user interface, data persistence, exceptions handling, loops, and searching algorithms. Arrays were used to store products and orders, with indexes tracking empty spaces. Nested if statements were used to check for object existence before additional validation. The GUI provides navigation and a user-friendly interface. Data persistence methods allow information to be saved and loaded. Exceptions are caught to handle errors gracefully. Loops are used for tasks like checking product stock levels. Searching algorithms allow finding objects by attributes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views14 pages

Criterion C Development

The document describes several complex programming techniques used in the development of a program for a business owner named Jimena to manage her products and orders, including arrays, complex selection (nested if statements), graphic user interface, data persistence, exceptions handling, loops, and searching algorithms. Arrays were used to store products and orders, with indexes tracking empty spaces. Nested if statements were used to check for object existence before additional validation. The GUI provides navigation and a user-friendly interface. Data persistence methods allow information to be saved and loaded. Exceptions are caught to handle errors gracefully. Loops are used for tasks like checking product stock levels. Searching algorithms allow finding objects by attributes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Criterion C

Classes
Complex techniques:
1. Array
2. Complex Selection
3. Graphic User Interface
4. Data Persistence
5. Exceptions
6. Loops
7. Searching Algorithms

Array:
I used this complex technique as the data structure in my program to allow the user to store
objects and manage them by performing essential actions such as adding and deleting,
complying with my first criterion for success. I made an array for Products and another for
Orders. Both can hold up to 1000 objects since around 900 products exist and per year she
sells around 240 orders allowing her to use it for reasonable amount of years.

As it is seen in the AdminProducts class, for the arrays I used a ‘top’ which is always located at
the first position empty, so that an object added is situated there.
When adding a Product, if there is space in the array, the Product is placed in the position where
the ‘top’ is. The ‘top’ moves one place to the right, so that the next Product is added in the first
position empty.
Complex Selection (Nested if):
I used an if statement inside another if statement in some methods, such as addOrder and
deleteProduct, to first check if an object exists and then, if the condition is true, check other
conditions as it can be seen below. They allow me to create methods that are necessary to
comply with my criterion of allowing the user to add, modify, delete orders and products, and
check if they exist.

In the deleteProduct method, the first if statement checks if the Product id exists. If it exists, the
statements inside it are executed, and it will get to the next if statement. It checks if the Product
‘id’ in position ‘i’ of the array is equal to the ‘id’ in the parameter. If this condition is true, the
statements inside it are executed.
It checks if the order exists to comply with my criteria for success of not allowing an existing
order to be entered.

Graphic User Interface:


It is essential as it allows the user to navigate through the program. Complying with my criteria
for success I also used it to provide a user-friendly interface. Always clear labels and back
buttons are used.
The GUI is made up of several windows that connect back to the main menu. To comply with
the sixth criterion for success this window allows Jimena to view all existing Products and
Orders, and also to navigate through them.
Data Persistence:
It allows Jimena to maintain all the new information when existing the program. I created the
methods SaveFile and ReadFile, to comply with my criterion of saving the information when
exiting the program, and reading the information when opening it. With the SaveFile the
information is stored in a text file. When reopening it, it is retrieved with the ReadFile, as it
transforms all the strings into corresponding variables.

● SaveFile

The SaveFile method is used when the “Exit Application” button is clicked.
● TextFile
● ReadFile
Exceptions (Try / Catch):
I used it to test for possible errors by catching exceptions, while the program is being run. This is
useful for dealing with errors and exceptions that might appear. For example, whenever a space
is not filled or wrongly completed, such as when deleting an Order a string is entered in the ‘id’
field, complying with a criterion for success, an error message appears transmitting the problem
and avoiding the program from crashing.
Loops:
I used this complex technique for creating methods that were necessary to comply with my
criterion of adding, modifying, deleting objects and checking if they exist. For example, in the
AddOrder method, I used a ‘for’, as it is seen in the image below, to check in each position of
the array of products selected by the user for this new order, if it was empty or if it had a
product. If the position of the array had a product, the quantities selected for that product would
be deleted from the stock. This ‘for’ is used to apply it for each of the selected products by the
user.

I also used loops in the FrontEnd. For example, in the addOrder window the user must be able
to select any product in stock, for that order. So a ‘for’ was used to display each of the products
that are in the products array.
Searching Algorithms:
Inside my program I used this complex technique creating a searching method for every
attribute of the objects. This complies with the criterion for success of allowing the user to
choose by which attribute to search products and orders. I used a linear search because my
data is not sorted, so it searches consecutively. The object found is returned to the FrontEnd. If
it does not exist the FrontEnd receives ‘null’ to then display a warning message.

Word Count: 803

You might also like