Sie sind auf Seite 1von 26

Unit 12 - Assignment 1 

 
Task and criteria 
 

 
 
For 2A.P1: learners should explain the purpose of the code for each of the two given 
programs, e.g. to carry out calculations, and explain the characteristics, including 
constructs and techniques being used within the program, e.g. variables and 
functions. The two software programs should be designed for different purposes.  
 
For level 1, as a minimum, learners should be able to identify the purpose of the 
code and identify the constructs and techniques, e.g. variables and functions.  
 
For 2A.M1: learners should review the quality (e.g. efficiency/performance, 
maintainability and usability) of the program. Learners should provide specific 
suggestions for improving the quality of this program. Learners should also include a 
flowchart showing how the program functions.  

For 2A.D1: learners should look at one software program in 


more detail and discuss the strengths and weaknesses of 
the product.  

Some sections you should definitely consider for the Pass 


part of this assignment 
Before you start this you should have completed all the code annotations for both 
programs. 

 
 
Task 1 
Introduction  
I am going to explore two different programs, a length converter and a price 
adjustment/calculator, I will find out what their purpose is and how well they 
work, what are they good at? Do they have any flaws? Do the apps port to 
other operating systems? I will also look into how efficient the code is written, 
can you get the same result with less code? Finally, I will discuss the strengths 
and weaknesses of one of the programs. 
 
 
Event driven programming  
Event driven programming is a programming paradigm, the way the 
program runs depends on events such as mouse clicks, keyboard strokes and 
other user generated actions or system generated actions like program 
loading. The code listens out for these things to happen and when it does, 
the code assigned to that action runs. 
Event driven programming differs from sequential programming because the 
flow of event driven programming is determined by the user’s inputs like 
mouse clicks, sequential programming flow is executed in the order it is 
instructed, the code runs from the top down. In summary if the program is 
reacting to the user then it is event driven, if the user is reacting to the 
program it is not. 
 
 
Forms and Gui’s 
Graphic user interface (GUI) uses icons, windows and menus to carry out 
commands. A GUI uses event driven programming because the user naturally 
produces events like clicks, mouse movement and keyboard presses, it is 
made up of forms which are windows that contain controls and components 
such as “OK” and “Cancel” buttons. 
 
 
 
 
 
 
 
 
 
 
Program 1 - Length Converter 
 
Purpose of program  
The purpose of the length converter is exactly what the title says, to convert 
lengths. A delivery business may use this if they have a distance in kilometres 
and they want to work out how many miles it is so they know how many miles 
they are getting per litre of fuel, or they have a delivery scheduled that is 
written down in kilometres and the driver wants to know how far that is in 
miles. 
 
 
What do the different parts of it do?  

 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
What programming command terms are there and what do they do in this 
program? 
 

Try​ - This means try to execute the code if something predetermined 


happens. In this code ​Try​ executes code when ConvertButton_Click is 
pressed. 
 
If,Then​ - This means the code is waiting for something to happen and if it does 
then it will do something else. In part of this code ​If​ box one has mile selected 
and box two has kilometre selected ​Then ​share the number entered by 
0.62137. 
 
End If ​- This is used when you have finished all your ​If​ statements. You have to 
have this or you will get an error, although it does enter it automatically. 
 
Catch​ ex ​As​ ​Exception​ - This means catch any errors in the code, if there are 
no errors it will be skipped. If there is an error then a message will appear to 
say “Something went wrong” 
 
MessageBox​.Show - This is the message box that I have mentioned above  
 
Help​.Show() - This is a subroutine that is run when PictureBox1_Click is pressed 
 
 
Validation  
There is a help button in this program which guides you on 
how to use the converter, this may help first time users of the 
program and stop them from making any mistakes, this 
makes it good validation 
 
 
 
As you can see from the screenshot 
you can type in the drop down 
menu box and when you click 
convert the program does nothing, 
it should tell you that you need to 
select an option from the drop 
down menu. This is bad validation. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This is bad validation because it tells you something went wrong but not 
exactly what you have done. It should say please enter an amount to 
convert. 
 
 
 
Variables  
These are all the variables in this program, they are 
all local variables. The first and second set of 
variables have the datatypes Boolean, this means 
that they are either true or false. Boolean is used 
here because you are selecting from a set list of 
options and the true or false is used to determine if 
you have selected one of the options or not. 
The last two have datatypes String, this means that 
they hold alphanumeric data and can also have 
spaces. It is used because the user needs to type in 
their own numbers, we cannot use an integer here 
because the user may want to convert a number 
with a decimal.  
 
 
What does each subroutine do?  
 
Subroutine one 
 
This is the first subroutine, this has most of the program in it. It starts off with the 
programme waiting for the button to be pressed, once that is done it runs the 
code underneath it 
 
Subroutine 2 
 
This subroutine starts off with the programme waiting for the “?” button to be 
pressed, once it is it will take you to a new subroutine called Help.Show() 
 
Subroutine 3 
 
This subroutine starts off with the programme waiting for the exit button to be 
pressed, once it is it will close the programme. 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
Program 2 - Wholesale App 
 
Purpose of program  
This program is a two in one, it has a calculator and also allows you to work 
out a price with or without VAT and also percentage discounts. Self 
employed people may use this app, say a plumber or electrician has come 
to your home to price up a job they can use this app to quickly add the VAT 
to their price so that you know the full amount. Retailers may also use this app 
to quickly work out the sale price of an item after the discount is applied. 
 
 
What do the different parts of it do? 
This is called a splash screen, you are greeted with it when you open the app 
and you have to choose what part of the app you want access. 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 

 
What programming command terms are there and what do they do in this 
program? 
 

Dim​ … ​As​ ​Decimal ​- This means that you are setting something as a variable 

with the data type decimal, which means it is not a whole number. In this 

program we have set number1 as a decimal, this is a decimal because when 


adding VAT to a number you are not guaranteed it’s going to be a whole 

number 

Const​ … ​As​ ​Decimal​ = 0.5 - This means that we know the thing we are setting 

this decimal to is constant and will not change. In the common calculations 

code Const VatAdd is set at decimal 1.2 because we know that VAT is 20% 

and does not change, so when somebody puts a number in number1 it will 

be multiplied by 1.2 to get the number plus VAT. 

If​,​Then​ - This means the code is waiting for something to happen and if it does 
then it will do something else. In part of the code for the common 

calculations ​If​ removevatText.Text has nothing entered into it ​Then ​a 

message box appears to say “Please Enter A Number” 

End​ ​If ​- This is used when you have finished all your ​If​ statements. You have to 

have this or you will get an error, although it does enter it automatically. 

Double​.Parse - This is used in the calculator code this converts what is entered 

in number1 and number2 which both have data types double into numbers. 
  

MessageBox​.Show - this is the message box that I mentioned in ​If​,​Then  

 
Math​.Round - This rounds the answer to a set number of decimal places. In 

the common calculations code it is used to round the answer of number1 * 

VAT to 2 decimal places. 

 
 
Validation  
 
In the calculator app if you do not select an 
operation but enter numbers and press calculate 
you get an error message saying, “Please 
Choose an Operation.” 
 
 
 
 
 
 
 
 
Also if you press calculate without entering any 
numbers an error box asks you to “Please Enter a 
Number.” This also appears if you have only 
entered one number.  
 
 
 
 
 
 
 
In the price adjustments app if you press 
calculate without entering any numbers at 
all an error box asks you to “Please Enter a 
Number.” 
 
 
 
 
 
 
 
 
In the price adjustments app if you enter 
anything but a number the program 
crashes and this error appears to say it was 
not the correct format. 
 

 
 
 
 
In the calculator app if you enter anything but 
numbers into ​both​ the boxes and press calculate 
you get the error message below, if you have 
entered text into one of the boxes and left the 
other blank then you will get an error saying, 
“Please Enter a Number.” 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Variables  
These are the variables in the calculator app, 
they are global variables and all have the data 
type double which means they are “real 
numbers” and can have decimal places in 
them. These are used instead of integer 
because a calculator needs to deal with all numbers not just whole ones. 
 
 
These are the variables for adding VAT in the 
common calculations app. They all use decimal 
which means they are also “real numbers.” 
Adding or subtracting VAT means that you on 
about money, this why decimal is used instead 
of integer because integer recognises numbers 
like -9 which isn’t a “real number” and not 
possible when talking about money. 
 
What does each subroutine do? (Calculator) 
 
Subroutine 1  
 
 
This subroutine first sets out the variables, then uses a series of If and ElseIf 
statements to state what calculation it wants the program to run. 
 
Subroutine 2 
 
This is to say if the addiction is checked then change the symbol to a plus sign 
and also clear the any answer in the box. 
 
Subroutine 3 
 
This is to say if the subtract is checked then change the symbol to a subtract 
sign and also clear the any answer in the box. 
 
Subroutine 4 
 
This is to say if the multiplication is checked then change the symbol to a 
multiply sign and also clear the any answer in the box. 
 
Common Calculations 
 
Subroutine 1 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 1.2 to add 20% to the value 
 
Subroutine 2 

 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.8 to remove 20% off the value 
 
Subroutine 3 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.9 to remove 10% off the value 
 
Subroutine 4 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.8 to remove 20% off the value 
 
Subroutine 5 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.7 to remove 30% off the value 
 
Subroutine 5 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.6 to remove 40% off the value 
 
Subroutine 6 
 
This subroutine sets out the variables and then does a multiplication of the 
number entered by 0.6 to remove 40% off the value 
 
 
 
Subroutine 7 

 
This subroutine waits for you to press the clear button when you do it runs this 
code to clear the text boxes and labels. 
 
 
Task 2 
EFFICIENCY 
 
The wholesale app is really efficient when it comes to how much memory 
and processing power it takes to run, as you can see from the screenshot it 
takes up 5.6 MB of available memory and uses around 0.5% of the CPU 
power. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The program runs very smooth and fast, when you choose an app from the 
splash screen it takes milliseconds to open the selected app and is just as fast 
when you ask it to make any calculations. The code in the calculator is 
written as efficient as possible, however the common calculations program is 
not written efficiently, it has been written with more lines than is necessary. 
  
Examples of code i would change in common calculations: 
 
 
 
 
 
There is no need to have these two variables. The rounding is unnecessary 
because you are using ​Math​.Round later on in the code, the answer variable 
doesn’t need to be there because you have answer in the brackets that 
follow ​Math​.Round. 
 
 
 
 
 
 
You can replace Rounding with ​Math​.Round and put the number1 * VatAdd 
in the brackets. This can be done for each subroutine changing the wording 
after the brackets to suit what the subroutine is doing. 
 
 
There is no need to have this in every subroutine, you could make a function 
that clears them and then just add the function to each subroutine. 
 
 
 
 
 
 
 
 
 
 
MAINTAINABILITY 
 
Some of the code and its comments in the common calculations app and 
calculator app can be improved to help with maintainability. 
 
Common Calculations: 
 
This variable does not tell you exactly 
what the number1 is, it could be 
renamed to NumberBeforePercent. This lets someone who is looking at the 
code for the first time know exactly that it is the number entered before a 
percentage is added or removed. The code comment should say exactly 
what it does like ​'This is the number entered before a percentage is added or 
removed. 
 

I think the variables and the code comments here tell you exactly what they 
are and what they do. 
 

All of these code comments tells you exactly what each of the lines do. 
 
 
This also tells you clearly what it 
does. 
 
 
 
 
 
 
 
 
 
This variable does say it’s going to take ten  but 
ten of what? It should say take ten percent, this should be applied to all the 
variables that have take and then a number after it. 
 
There are no other code comments in the common calculations program, 
however most of the code comments from the first subroutine can be 
transferred over with a few changes.  
 
 
 
 
 
 
 

 
The subroutines are named quite well, they say what each of them are 
about, although if you want to be really precise you could rename the 
TenPercentBtn one to RemoveTenPercentBtn and so on which is explaining it 
is just removing percentage. 
 
Calculator: 
 
Both the two number 
variables are not very 
good because it does 
not tell you what the 
number is, should be named FirstNumberToCalculate and 
SecondNumberToCalculate respectively. The code comments are good but 
they should comment under everything to make sure everybody knows 
exactly what it is.  
 

There is no code comments here explaining that this is to stop the app from 
crashing if certain things happen. 
 
 
 
 
 
 
Even though this code explains what the code is doing when it comes to 
checking for a zero because it cannot divide by zero, it fails to explain what 
the code below does. 
 
 
 
 
 
 
 
 
 
 
 
 
 

This explains clearly what this subroutine is doing and even though there are 
no code comments in the rest of the similar subroutines these comments 
apply with the change of just one word. 

 
Some of the subroutines could be named better mainly the calculation 
change ones, the should be named ChangedToAddition and so on. 
 
 
 
 
 
 
PORTABILITY 
The program will work on any computer running Windows without the need to 
install anything because since Windows XP SP2 update they all have the .NET 
1.1 Framework pre-installed. It will also work on a Mac if you have installed 
Windows either, as a separate startup using Boot Camp, or using software 
like Parallels Desktop which lets you run Windows as an application, it will not 
however work on any machine running any other operating system. 
“​Microsoft held 89.23% of the OS market in April 2016​” (1) which means that 
the program has quite good portability because Microsoft has a huge share 
of the market. To make it more portable it would be better if it was online, this 
way everybody with an internet connection can use the app.  
 
 
 
RELIABILITY 
 
 
 
 
 
 
 
 
 
 
The calculator is really reliable unlike other calculators that start to round the 
numbers up after a certain amount of decimal places. If two companies on 
the stock exchange used different calculators, one with Google’s and the 
other with this calculator and used them to work out a price of the same 
thing they were buying and it had more than 9 decimal places then the 
company using our calculator would pay less than the other company, the 
price difference could be huge if large amounts were being bought. 
 
 
 
 
 
 
 
 
The price adjustments are also very accurate if you do not need to know 
exact decimal numbers, if you need to reduce or increase a number with 
more than two decimals and need to know a very exact answer then this 
calculator is not the one you should use. The internet percentage calculator 
gives a very precise answer. 
 
 
 
Validation 
 
All of these error boxes should let the user know what they have done wrong 
and give them an opportunity to correct their mistake. 
 
 
This appears if you have not selected an 
operation, I think this would be better if it said 
“Please Choose a Calculation” instead of 
operation because operation doesn’t mean 
anything to the average person. 
 
 
 
 
 
 
If you press calculate without entering any 
numbers an error box asks you to “Please Enter a 
Number.” This also appears if you have only 
entered one number. While this is okay i think it 
could be better if it said something like “Please 
Enter 2 Numbers” if you pressed the calculate button without selecting or 
entering anything, this lets the user know they have to enter two numbers. If 
you have only entered one number then it should say “Please Enter a Second 
Number” these give clear instructions to the user what to do. 
 
Also if you enter anything but numbers into ​both 
the boxes and press calculate the app crashes, 
this is not good because the user may not know 
what has gone on. There needs to be an error box 
come up to explain saying something like “Please 
Enter Only Numbers.” 
If you have entered numbers in one box and text 
in another it says “Please Enter a Number.” this is 
not good because it does not tell you that the text 
you have entered is wrong, it should say something like “Please Enter Only 
Numbers.” this way the user knows not to enter text. 
 
 
 
 
 
 
Like the calculator app if you click 
calculate without entering a number a box 
appears saying “Please Enter a Number” 
this is perfectly fine because it is telling you 
exactly what you need to do. 
 
 
 
In the price adjustments app if you enter 
anything but a number the program 
crashes and this error appears to say it was 
not the correct format. This is bad because 
the user may have slipped a letter or symbol 
into the box without realising and the app just crashes, the user will not know 
what has happened. There needs to be an error box appear telling them 
exactly what is wrong, something like “Please Enter Only Numbers” this will 
make the user aware of exactly what they have done. 
 
 
USABILITY 
 
The program is very easy to use for the most part, the splash screen is a good 
bright colour with two clear options of which program you want to choose, 
although I don’t think you need to add the word program after calculator 
because the word calculator says what it does. You could put these two 
programs into one that does it all instead of having the need for a splash 
screen and a choice. The calculator does not act like a normal calculator I 
think the calculations should be buttons that you press instead of selecting a 
radio button, this will make the calculator feel familiar to the user. 
 
If we incorporate the two programs together then there can also be a 
percentage button, if a user wants to add a percentage say VAT to a 
number they will first enter the number, then press the add button and enter 
the amount they want percentage of, in this case 20% then press the 
percentage button to get the answer, so 100 + 20% =. This can also be done 
for percentage reduction by swapping the add button for a minus one, 
another reason to make it one program is, in the price adjustments program 
the percentages are set, if it was built into the calculator the user could type 
in the exact percentage they want also the common calculations, with the 
exception of adding VAT only decreases. 
 
There are error messages in this program that do not explain what the the 
user has done wrong. This is really bad when it comes to usability because if 
this app was used by the general public and they make one of these errors 
the program will crash without warning, the user will not know what they have 
done wrong and probably not use the app again 
 
Flowcharts 
 

20% reduction flowchart, all other buttons in the app do the same thing 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Calculator flowchart 
 

 
References 

1. https://www.extremetech.com/computing/227693-windows-drops-bel
ow-90-market-share-for-the-first-time-in-years-windows-7-falls-below-50 

 
 
Task 3 
 
Strengths and weaknesses of Wholesale app 
 
Strengths 
The calculator app can handle up to 14 decimal which makes it really 
precise compared to other online calculators that would round an answer, 
this could save a company millions of pounds. Another strength is that it is 
very simple with just the ability to add, subtract, multiply and divide although 
this could be a weakness as well. The calculator is really straightforward and 
easy to use with a lovely and bright yellow background which makes it 
visually appealing. The price adjustments app gives the user a quick way to 
add or remove VAT, it also lets you quickly work out certain percentage 
reductions. It is quite clear to the user on what it does with the bold heading 
saying “Price adjustments”, it also bright and colourful with the same yellow 
background. 
 
 
 
Weaknesses 
The program is split into two different apps which seems unnecessary 
because they would function completely fine as one program. As I have 
already mentioned the calculator app is very simple and does not offer 
anywhere as near as much as some online calculators, so unless you only 
want to do some simple maths the calculator is not suitable. There are far too 
many ways to crash both the calculator app and price adjustments one as 
well, this makes it not ready for use by the general public. In the price 
adjustments app it allows you to add or remove VAT which is great but it 
should say what percentage VAT is because if VAT changed without the app 
being updated someone using it will get the calculation wrong. The app also 
only lets you reduce percentages and not increase them which limits its 
usefulness, the percentages are also set at fixed amounts so does not give 
the user full control over the percentage amount.  

Das könnte Ihnen auch gefallen