Programming Concepts. Andora Video is a small shop selling videos. The owner, Raul, wishes to develop a sales transaction processing system. The main objective of this system should be to display the total price of the sale after discounts, tax e.t.c.
Extracts from this document...
Introduction
Unit 3 – Programming Concepts
PROGRAMMING CONCEPTS | |
Table of Contents
INTRODUCTION
SCENARIO
USER REQUIREMENTS
INFORMATION
GUI (GRAPHIC USER INTERFACE)
VERSION 1
REQUIREMENTS
DATA TABLE
DESIGN PSEUDOCODE
IMPLEMENTATION (v. 1)
TESTING
Syntax Errors
Logical Errors
VERSION 2
REQUIREMENTS
DATA TABLE
DESIGN PSEUDOCODE
IMPLEMENTATION (v. 2)
TESTING
Syntax Errors
Logical Errors – Order 1
Logical Errors – Order 2 (first attempt)
Logical Errors – Order 2 (second attempt)
VERSION 3
REQUIREMENTS
DATA TABLE
DESIGN PSEUDOCODE
FINAL IMPLEMENTATION (v. 3)
TESTING
Database connectivity
EVALUATION
CONCLUSION
BIBLIOGRAPHY
BOOKS
WEBSITES
SOFTWARE
INTRODUCTION
SCENARIO
Andora Video is a small shop selling videos. The owner, Raul, wishes to develop a sales transaction processing system. The main objective of this system should be to display the total price of the sale after discounts, tax e.t.c. This should occur as a result of the input of data surrounding the video and its purchase.
USER REQUIREMENTS
- An application that is able to process multiple video titles
- Calculates discounts, VAT and totals
- Determine different discounts based upon the quantity
- Display calculations in relevant format
- Store inputted and calculated data into a electronic record
- Capable of supporting further development
Although Raul needs the application to process multiple video titles in one transaction, I shall however start off with designing a simple program to process just one title at a time. After that, I intend expanding from this stage, adding more functionality as time goes on with each version.
INFORMATION
Some of the work was carried out directly from the command prompt in Windows. However, at other times an integrated development environment (IDE) was used so one may see a difference in the error message output. The IDE used was the Open Source NetBeans software version 6.1 for Windows Vista.
Testing is carried out on all versions and any errors corrected and explained.
Middle
Output: String vdID, vdTitle,
int vdQty, itemCount, vdQtyAll,
double vdPrice, vdSubtotal, vdSubtotalAll, dSubtotal, vdTotal, discount, VAT
Process: vdSubtotal = vdQty*vdPrice
vdQtyAll +=vdQty
vdSubtotalAll+=vdSubtotal
discount=vdsubtotalAll*disFor…
dSubtotal=vdSubtotalAll-discount
VAT=dSubtotal*vatRate
Total=dSubtotal+VAT
DATA TABLE
Name | Description | Type |
vdID | Video ID entered | string |
vdTitle | Video Title entered | string |
vdQty | The quantity of a particular video entered | int |
vdQtyAll | Calculated total of all quantity of videos | int |
vdPrice | The price of a particular video entered | double |
ask | The choice to continue or not entered | string |
vatRate | The decimal value of the VAT rate | double constant |
disFor5To9 | The decimal value of discount percentage given to those who buy 5-9 videos | double constant |
disFor10To14 | The decimal value of discount percentage given to those who buy 10-14 videos | double constant |
disFor15Plus | The decimal value of discount percentage given to those who buy 15 or more videos | double constant |
VAT | VAT rate multiplied by the already discounted subtotal | double |
vdSubtotal | Holds calculated subtotal for a video title | double |
vdSubtotalAll | Holds calculated subtotal for all video titles | double |
dSubtotal | Holds calculated subtotal of all the videos after relevant discount has been taken off | double |
discount | Holds the relevant discount depending upon the whole video quantity order | double |
total | Holds calculated total of whole customer order | double |
indata | Used in the process of converting various strings to integer variables | String |
DESIGN PSEUDOCODE
Declare vat and discount rates constants
Prompt for video ID, Title, Price and Quantity
Read inputted values
vdSubtotal = vdPrice*vdQty
Add vdQty to vdQtyAll
Add vdSubtotal to vdSubtotalAll
Display string asking if to continue
while ask = 'y' or 'Y'
repeat all above
while ask = 'n' or 'N'
display vdQtyAll
display vdSubtotalAll
if vdQtyAll >= 15
discount = disFor15Plus * vdSubtotalAll
if vdQtyAll >= 10
discount = disFor10To14 * vdSubtotalAll
if vdQtyAll >= 5
discount = disFor5To9 * vdSubtotalAll
else
discount = 0
display dSubtotal
display vdtotal
IMPLEMENTATION (v. 2)
import java.util.Scanner;
import javax.swing.JOptionPane;
public class VideoSales2
{
public static void main (String[] args)
{
//Declaring Variables needed in the program and added values to the constants
String ask="";
double vdSubtotalAll=0;
double vdQtyAll =0;
final double vatRate = 0.175;
String vdID, vdTitle, indata;
int vdQty;
double vdPrice, discount;
final double disFor15Plus = 0.25;
final double disFor10To14 = 0.17;
final double disFor5To9 = 0.12;
Conclusion
This worked and the following data successfully entered the relevant table in the database.
EVALUATION
I am satisfied that my application fulfils the basic user requirements; however it does leave room for improvement and further development. For example, it is able to process multiple video titles but I would like to, in the future, make the process of entering the video information easier by creating a better designed GUI.
The calculations all eventually passed the rigorous testing stage but the storing of these calculations rather than just the user input is another improvement that could be made. All the data together could then be displayed and even printed onto an itemised receipt.
I have left the program in a position in which the database functionality can be expanded on, to connect to a network. The program could even respond to scanned barcodes in relation to records held in the database.
CONCLUSION
The program is structured well with comments on all the major aspects, and I do believe that the above User Documentation is easy to understand and laid out in a good manner. The User Guide has screenshots to make the learning process easier.
This project was done under minimal supervision, and actually, I surprised myself in learning some of the key programming concepts by having to learn from and fix my own mistakes.
BIBLIOGRAPHY
BOOKS
- Deitel H. & P. (2001) Java How To Program 4th Edition, Prentice Hall
- McGrath, M. (2003) Java in easy steps, Computer Step
- Knott, G. & Waites, N. (2002) BTEC Nationals for IT Practitioners, Durham: BC Publications
- Parsons, J. J. & Oja, D. (2006) Computer Concepts, Sixth Edition, US: Course Technology Inc.
- Long, L. & N. (2005) Computers: Information Technology in Perspective 12th Edition, NJ: Pearson Education
WEBSITES
- http://java.sun.com [Accessed 01 May 2008]
- http://books.google.co.uk [Accessed 03 May 2008]
- http://www.freejavaguide.com/corejava.htm[Accessed 15 June 2008]
- http://www.java-forums.org[Accessed 16June 2008]
SOFTWARE
- Microsoft® Student 2008 [DVD]. Redmond, WA: Microsoft Corporation, 2007
Page of
This student written piece of work is one of many that can be found in our University Degree Software Engineering section.
Found what you're looking for?
- Start learning 29% faster today
- 150,000+ documents available
- Just £6.99 a month