Saturday, April 4, 2015

Invoicing application

Sample Java code for an Invoice class, this was part of an invoicing application for Android I was working on...
import java.text.NumberFormat; import java.util.Scanner; public class InvoiceApp { public static void main(String[] args) { // display a welcome message System.out.println("Welcome to the Invoice Total Calculator"); System.out.println(); // print a blank line Scanner sc = new Scanner(; String choice = "y"; while(choice.equalsIgnoreCase("y")) { // get user entries String customerType = Validator.getString(sc, "Enter customer type (r/c): "); double subtotal = Validator.getDouble(sc, "Enter subtotal: ", 0, 10000); // calculate the discount amount and total double discountPercent = getDiscountPercent(subtotal, customerType); double discountAmount = subtotal * discountPercent; double total = subtotal - discountAmount; // format the values NumberFormat currency = NumberFormat.getCurrencyInstance(); NumberFormat percent = NumberFormat.getPercentInstance(); String sSubtotal = currency.format(subtotal); String sCustomerType = ""; if (customerType.equalsIgnoreCase("r")) sCustomerType = "Retail"; else if (customerType.equalsIgnoreCase("c")) sCustomerType = "College"; String sDiscountPercent = percent.format(discountPercent); String sDiscountAmount = currency.format(discountAmount); String sTotal = currency.format(total); // format and display the results String message = "Subtotal: " + sSubtotal + "\n" + "Customer type: " + sCustomerType + "\n" + "Discount percent: " + sDiscountPercent + "\n" + "Discount amount: " + sDiscountAmount + "\n" + "Total: " + sTotal + "\n"; System.out.println(); System.out.println(message); System.out.print("Continue? (y/n): "); choice =; System.out.println(); } ---------------------------------------------------------------------------- the Invoice class import java.text.NumberFormat; public class Invoice { //instance variables private double discountPercent; private int discountAmount; private double invoiceTotal; // the constructor public Invoice(SubTotal, CustomerType) { this.SubTotal; this.CustomerType; } public double setdiscountPercent(double discountPercent) { this.discountPercent = discountPercent; } public double getdiscountPercent() { return discountPercent; } public double setdiscountAmount(int discountAmount) { this.discountAmount = discountAmount; } public int getdiscountAmount() { return discountAmount; } public double setinvoiceTotal(double invoiceTotal) { this.invoiceTotal = invoiceTotal; } public double getinvoiceTotal() { this.calculateTotal(); return invoiceTotal; } private void calculateTotal() { double invoiceTotal = discountPercent * discountAmount; } public String getInvoice() { NumberFormat currency = NumberFormat.getCurrencyInstance(); return currency.format(this.getinvoiceTotal()); } }

Saturday, December 20, 2014

2015 for Johnny...

2015 is about to come and, realistically I hope the following goals will be met:
1) revenue comes in on time for a change...
2) I settle down in a job and learn to do better programming as it is tough
3) I become more independent
4) I lose some fat as I cannot fit into any of my old clothes
5) I become more social as I have become a loner, although I do not really wish to do this I am fine with being a loner, really, this was just the doctor's suggestion at my apparent quick change of moods.
6) I want to make some money and buy a few things that I need
7) No big goals for this year, the world seems like a mess for now...except for funding a business.

Friday, December 19, 2014

The game which does not draw a robot...

package kiloboltgame; public class Robot { private int CenterX = 100; private int CenterY = 382; private boolean jumped = false; private int speedX = 0; private int speedY = 1; public void update() { //moves character or scrolls background if (speedX < 0) {CenterX += speedX;} else if (speedX == 0) { System.out.println("Do not scroll in the background");} else { if (CenterX <= 150) {CenterX += speedX;} else { System.out.println("Scroll background here"); } } //updates Y position if (CenterY + speedY >= 382) {CenterY = 382;} else {CenterY += speedY;} //handle jumping if (jumped == true) { speedY += 1; if ((CenterY + speedY) >= 382) { CenterY = 382; speedY = 0; jumped = false; } } //prevents going beyond the coordinate of zero if (CenterX + speedX <= 60) { CenterX = 61; } } public void moveRight() {speedX = 6;} public void moveLeft() {speedX = -6;} public void stop() {speedX = 0;} public void jump() { if (jumped == false) { speedY = -15; jumped = true; } } public int getCenterX() { return CenterX; } public int getCenterY() { return CenterY; } public boolean isJumped() { return jumped; } public void setJumped(boolean jumped) { this.jumped = jumped; } public int getSpeedX() { return speedX; } public void setSpeedX(int speedX) { this.speedX = speedX; } public int getSpeedY() { return speedY; } public void setSpeedY(int speedY) { this.speedY = speedY; } } package kiloboltgame; import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.color.*; import java.awt.Frame; import java.awt.event.*; import java.awt.image.BufferedImage; import java.awt.Graphics; import java.awt.Image; import*; @SuppressWarnings({ "unused" }) public class StartingClass extends Applet implements Runnable, KeyListener { /** * Demo game developed as per tutorial at */ private static final long serialVersionUID = -6721512236300497716L; private Robot r; private URL base; @Override public void init() { super.init(); setSize(800,480); setBackground(Color.BLACK); setFocusable(true); Frame f = (Frame) this.getParent().getParent(); f.setTitle("Q-Bot Alpha"); try { base = getDocumentBase(); } catch (Exception e) { e.printStackTrace(); } //image setups character = getImage(base, "img/robot.jpg"); addKeyListener(this); } @Override public void start() { //TODO: write implementation code super.start(); Thread t = new Thread(); t.start(); Robot r = new Robot(); } @Override public void stop () { //TODO: write implementation code super.stop(); } @Override public void destroy() { //TODO: write implementation code super.destroy(); } private final int DELAY = 20; public void run() { while (true) { repaint(); try { Thread.sleep(DELAY); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: break; case KeyEvent.VK_DOWN: break; case KeyEvent.VK_LEFT: break; case KeyEvent.VK_RIGHT: break; case KeyEvent.VK_SPACE: break; } } @Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: break; case KeyEvent.VK_DOWN: break; case KeyEvent.VK_LEFT: break; case KeyEvent.VK_RIGHT: break; case KeyEvent.VK_SPACE: break; } } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } private Image image; private Graphics second; public void update (Graphics g) { if (image == null) { image = createImage(this.getWidth(), this.getHeight()); second = image.getGraphics(); } second.setColor(getBackground()); second.fillRect(0, 0, getWidth(), getHeight()); second.setColor(getForeground()); } Image character; public void paint (Graphics g) { //TODO: fix this bug g.drawImage(character, r.getCenterX() - 61, r.getCenterY() - 63, this); } }

Saturday, October 4, 2014

Web Service (Java)

A very simple web service created with Eclipse IDE/Java
package com.weathercheck;
public class WebServer {
public static void main(String[] args) {
System.out.println("Webservice running.");
WebConnection conn = new WebConnection();
System.out.println(conn.Connected("Server "));

} package com.weathercheck;

import javax.jws.WebMethod;
import javax.jws.WebService;
public class WebConnection {
public String Connected(String message)
{ return message + "connected.";}

Wednesday, March 26, 2014

Teleworking today...

Teleworking allows employees work at home or at a local telework center one or more days per week using communication tools, such as such as phone, fax, modem, Internet teleconferencing, e-mail or IM, to perform work duties from a remote location. The term telework is the term favoured in Europe and other countries while telecommute is used more often in the U.S and Canada. ( Teleworking brings about the added benefit to employees, to be able to work from locations without having to travel long distances to their workplace. It also brings us closer to clients and business partners while we are travelling, because we can simply use information provided by the information systems of a company and showcase it there and then, rather than having to come back "later" with information. Time to respond, can be an effective competitive advantage in a highly competitive business world. For example, insurance representatives are usually armed with laptops and presentations demonstrating the forecasts of life policy returns instantly, and, they have been using remote means of working for over a decade, in the author's experience. Mobile working may also give the impression of flexibility, in that employees are given the option to work from any location or from locations where connectivity is securely allowed, for example over a virtual private connection between the head office and the branch office. Nevertheless, one needs to appreciate the fact that mobile working is limited by the availability and reputation of the underlying technologies, particularly the Internet infrastructure - which is running out of static IPv4 addresses - and, the connection speed, on which there have been complaints recently. Whilst this practice seems to have been widely adopted, due to the perception that most persons can access their web-based email and avail from smartphones and other devices, Marissa Meyer, CEO of Yahoo Inc. (2013) decided to do away with teleworking connections after finding out that some of the teleworking employees were found to have been "tele-slacking" i.e. the employees were not actually logging on to work, and, Ing. Meyer felt that she had to take a drastic decision, asking them to return to the office to work. "The come-to-work order was first reported when a leaked memo from Yahoo's human resources director was published by a tech blog in February." Sourced from This practice was not completely agreed with by magnate Richard Branson, who seems to favour teleworking as today's way of working. Nevertheless, the risk of abuse still exists: Bob had simply outsourced his own job to a Chinese consulting firm. Bob spent less that one fifth of his six-figure salary for a Chinese firm to do his job for him. Authentication was no problem, he physically FedExed his RSA token to China so that the third-party contractor could log-in under his credentials during the workday. It would appear that he was working an average 9 to 5 work day. Investigators checked his web browsing history, and that told the whole story. Sourced from Ryan seems to corroborate that speed and quality are often sacrificed when we work from home. How does this influence productivity? Within the Republic of Malta, teleworking is regulated by subsidiary legislation 452/104, which defines telework as "a form of organising and, or performing work, using information technology, in the context of an employment contract or relationship, where work, which could also be performed at the employer’s premises, is carried out away from those premises on a regular basis". This indicates that the legal definition of teleworking allows for working at a branch office, and, this form of teleworking is adopted by real estate entrepreneurs, who prefer to recruit sales agents on a self-employed (sub-contracting) basis, and, offering the services of providing office equipment including a company telephone in order to carry out prospecting and sales duties from the branch office. The employer has the legal right to accept or refuse duties carried out over a teleworking connection. Broadband connection problems, and, other Internet connection problems were common in the Maltese islands since the introduction of Internet service as commercially available to personal and corporate customers. 77.5% of households in Malta and Gozo had access to the internet last year (2012), according to NSO figures reported by Unfortunately more recent statistics were not available at the time of writing. The Government of Malta, had in the past introduced schemes such as Blue Skies to encourage third age citizens in buying broadband connection at subsidized rates, however, there is no guarantee that this was taken up by all the members of the ageing population, and, this leaves them at the risk of being marginalized. Does this meant that the remaining 22.5% would not be familiar with using internet to carry out business, or attend to their day to day shopping needs? Yet, technology moves on and awaits us, consumers to jump on the bandwagon and buy in to the latest technologies, such as the latest iPhone, or other smartphones available. Vodafone (Malta) have recently inaugurated the first 4G network in Malta. Will this bring about more options for mobile working, or are we feeling like we have more options than we might need? Do you still have a single mobile phone, or do you carry about a laptop, a smartphone, a tablet, and, a few other devices as part of your daily carrybag? clarifies that teleworking can be required as part of a job description for new starters, but if an existing office-based job is to be changed to teleworking, it should be a voluntary arrangement for both the worker and the employer. In either case, prospective employees being offered a job need to read the terms and conditions of the contract of employment and reflect how this will affect their work-life balance, particularly if they have parenthood responsibilities. This essay does not attempt to understand whether this is perceived as fair or not considering the different forms of employment options available, but nevertheless provides evidence that teleworking has been adopted for over a decade that seems to have provided employers with the benefit of asking employees to access information hosted on companies' servers remotely, thus being able to read and reply their emails promptly, or even accessing the information systems used within the organization. Employees may feel that they can never leave the workplace when teleworking, given the pervasive manner technologies such as smartphones, tablets and other devices surround us whilst we are trying to find some private space of our own. The boss might call and ask questions even though you are not meant to be working at 01:00 AM, because he is aware you read your emails till late morning. Does this create any stress related issues? The author has been through burn down stress and other adverse health conditions that to date have benefited nobody, not even the author himself, who has been left to the consequences of his misfortune by the executives who once brandished their business suit as if it was the Knight's armor. You would not even imagine the costs in terms of health and recovery, not to mention the family related problems that stress may bring upon the dependants of the victim. Dr. Debono, a previous Member of Parliament also complained of health issues during 2012-2013, and, farcically, the people he represented perceived him as a rebel, and, at times as "weak". After his public political feud between Dr. Franco Debono and ex-Prime Minister, Dr. Lawrence Gonzi, the latter had publicly complained to have been flooded with numerous SMSs by Dr. Debono. This is a fierce showcase of mobile telephony misused, since it alienated Dr. Gonzi from what might have been clarified in a face-to-face meeting, however, we do not intend to debate the personal issues between politicians, but merely to illustrate how mobile devices can be misused. As a matter of fact, cyber-stalking is being currently debated by a prominent politician in order to protect the interests of individuals whose private lives might have been damaged with the influx of social media and the excessive use of mobile phones and social media to share our personal lives with the public. It is known that some software engineers have revealed company secrets over social media, and, other persons have had their employment terminated over improper conduct published on social media, through the careful prying eyes of modern day human resources practitioners who protect the interests of the employing organization, at times by prying into the employees' private lives, and, ensuring that the code of conduct has not been breached. At this point, some employees may feel that their privacy is being invaded. Similarly, for the purposes of security we have to undergo numerous checks such as checks at the airport, and, when one has to travel regularly, these checks may become a nuisance, and at times might be a valid question whether they are a health hazard. For example, the author tends to question airport staff whether X-Ray spot checks at Heathrow Airport, London will have negative side effects on one's health, since it is not healthy to expose oneself to too many X-Rays within a defined period of time. Unfortunately the staff handling the equipment are not usually qualified radiologists and tend to give 'white lies' encouraging the individual to undertake such tests. Now this might not have happened to anyone else, so you would not even have an idea what it means to the victim, and, it would seem that few people do actually, according to research. Most people see stress-related symptoms as 'alien' until it hits them and they actually have to go through the side-effects of such symptoms. This leads us to understand that publicly acknowledging stress can have a negative effect on the reputation of an individual, and, even, though prejudice is - strictly speaking - against the basic right to be respected, some employers and people who lack awareness of such rights prefer to follow their instincts and prejudices rather than understand what stress means for its victims. Again, this brings about a perceived demand for professional human resources management, and, in understanding what empathy is about. Unfortunately, it would seem that managers who seem to have been educated by F.W. Taylor have little awareness of the basic needs around managing human beings. Indeed, sometimes we need to remind our managers that we are only human beings, because their expectations are as ambitious as the ways they organize to ensure that employees never actually 'leave the workplace'. Is there a need to force the state of being a workaholic upon employees, or is it just adrenalin that drives scientifically-driven managers? White (2013), clearly states that when the spotlights are switched off most public figures have to manage the same debilitating effects of being human. Not "being seen in the office" may affect a person's chances of promotion, result in a smaller pay rise than office-based peers and lower performance evaluations, according to research by the London Business School and the University of California. Sourced from, written by M. Ryan. This issue seems to have been confirmed as a negative perception by other employers as well (Theuma/Aquilina 2012/2013). Nevertheless, teleworking brings about advantages, including technology at your fingertips. News feeds (e.g. RSS Feeds), email, and, information systems can be accessed from any device which connects to the world wide web, and, nowadays that includes laptops at WiFi spots, smartphones, tablets, and, even nifty devices such as Google Glass, useful contextual information on the locality being visited, or translations on the fly displayed through a tiny screen that is bundled along with in the form of a reading glass. Mobile working has speeded up and has had an obvious impact on electronic commerce. We can download mobile applications instantly, and, read our emails from just about everywhere. We are so flooded by emails, that the Data Protection Legislation protects our privacy by requiring the explicit consent of the data subject prior to being provided with promotional information. Nevertheless, this regulation is not strictly adhered to, especially as Maltese political parties are approaching election time, and, they feel the urge to reach out to potential voters with their multi-channelled marketing campaigns that take the form of digital marketing, direct marketing and the most extroverted of public relations that rises to the level of a rock concert. Ironically, the politicians then complain about running out of funds when they are required to feed the needy, or to run campaigns for the socially disadvantaged, and, the layman would probably ask whether budgets are being allocated in a socially responsible manner, rather than being driven by "election fever". Does this happen in your country as well? One this is for sure, mobiles do not even leave politicians at rest, because they answer at every hour, and, publish campaigns on social media. This is an advantage given that up to a few years ago we accused politicians of being too secretive and lacking transparency. Liberalism and the need for transparency may have forced the politician to act more responsibly in the public interests, thanks to evolving technologies and mobile working. Technologies have created thousands of jobs, and, the IT industry has not been seen any decrease in demand for integrated technologies, mobile applications, websites and all sorts of technologies that bring about convenience at anyone's fingertips. All this started with a few 'garage-bred' ideas of a few American and British entrepreneurs on the likes of Bill Gates, Sir Tim Berners Lee, and, others, and, technology is around us nowadays, looking at us with its prying eyes. Does this give you a sense of security or does it invade your privacy? It depends how you look at it, some people have nothing to hide, others cannot state the same. One man's meat is another man's poison, as the saying goes. In the Maltese islands, if you are caught talking on your handheld mobile phone by a traffic policeman, you are liable for a fine, because, they assume that the human mind cannot focus on driving and on handling the phone. In fact, some people wish that managers had the same lines of thought before putting pressure on surrealistic commercial deadlines that must be met, and, in both cases you get penalized for breaching a rule that someone else has created. Therefore technology has brought about the added source of revenue for Transport Malta, to help Malta out of its public debt by giving hefty fines to people who are unaware of the use of mobile phones with "handsfree" earpieces or sets that can be integrated to the car speakers and microphone without distracting the driver of a recent BMW from keeping his or her eyes on the wheel. Wang and Strong outline the following dimensions by which quality of information can be analysed including intrinsic, contextual, representational and accessibility of information. These dimensions bring about the importance of coding standards to be adhered to when engineering an application for mobile phones or for other mobile devices. How does this influence the importance of quality management upon the profession of software engineering, and, the need for coherence when displaying information required for productive use, and, for public scrutiny? What is the cost of an error nowadays in terms of rework and reputation? Mobile working can be an advantage in the sense that it connects people in faraway places and allows managers not to worry about having to pay for travelling and work-permits since employees and sub-contractors can work remotely at a lower cost than an air-ticket and accomodation. Mobile working takes advantage of the Internet infrastructure to allow people to collaborate through various technologies, such as Skype and social media, and, shared applications. On the other hand, mobile working can result in information overload, undue stress, and, surreal expectations, if we do not manage human resources adequately. References 1. They myth of working from home, available [online] at 2. Stress and distress in public life, available [online] at 3. Wang, R. & Strong, D. (1996) "Beyond Accuracy: What Data Quality Means to Data Consumers". "Journal of Management Information Systems", 12(4), p. 5-34., as quoted on, last updated on 4th October 2013. 4. Employee Subcontracts Own Work to China, Collects Full Salary, Watches Cat Videos available [online] at, updated on 17th January 2013. 5. 2012: The year when Franco Debono ‘went the distance’, available [online] at 6. The principles of scientific management, available [online] at 7. Debono denies ‘taunting’ Gonzi with SMSes at all hours, available [online] at 8. Anti-cyber harassment alliance setup, available [online] at 9. How X-Rays Work?, available [online] at 10. IPV6 Address Space, available [online] at 11. 5600 new broadband connections thanks to Blue Skies, available [online] at 12. Vodafone brings 4G to Malta, available [online] at 13. Banking at your fingertips, available [online] at 14. Major step for EU Telecoms Single Market, available [online] at 15. Ronald Aquilina, Innovation of e-Business Lectures (IS3167). 16. BMW Bluetooth Kit, available [online] at

Monday, January 20, 2014

Why social marketing can boost your sales?

In the U.S. alone, Twitter’s ad revenue showed an increase of 93 percent over the same period the previous year, with $277 million posted for the first three quarters in 2013. Although sensationalist media have criticized the use of Facebook, Mark Zuckenberg's biggest "software baby" has been the landmark of many other social media networks. Social media is growing, there must be a good reason behind its popularity... Your business could either tinker with all the free trials offered by social media, or else they can simply tap in to their full capabilities by budgeting for a web marketing campaign and a social media campaign in a similar manner that an executive would budget for the cost of labour. Innovative technologies are addictive Facebook is popular due to its close affiliation with human psychology that has made this social network intuitive enough for kids and adults alike to use it at their discretion to play games, read news feeds, share information with their peers and engage in day to day discussion about just anything they fancy, not to mention the possibility to create their own pages, themes, businesses, and, organize their online profile, in a similar manner as they would look in the mirror a few times before hanging out for a cocktail. Therefore each network which has opened channels of communication between celebrities and their fans has a unique way of presenting itself to the users of the world wide web, and, it also can be accessed from a desktop, a laptop, a smartphone or a tablet, although the user interaction might slightly differ. Cross-posting was traditionally disallowed on user forums, whilst it is encouraged within social media as it encourages linking between different social networks, as the raison d'etre of a social media is to disseminate information rather than to try to retain exclusivity on the information within a particular domain. The latter might be the philosophy of technical forums, however, social media is based on an outward looking management philosophy that keeps in mind the need for public relations to the organization and the individual, keeping lines of communication open on both sides. Multimedia Designers can cost quite a few bucks, with a social media marketing campaign that suites your needs and your budget you can actually control the level of audience penetration as you take advantage of existing pricing models which allow you to set a budget in advance, and, enhance your visibility on the web (in the case of Google Page Ranking) or through the social media in a manner that suites your business theme and marketing strategy. Contact me if you require further information on social media integration or social media marketing, we can help with both. Follow my facebook page at References 1. Are You Engaged in Revenue Producing Activities?, available online at 2. Top Tips for Effective Social Media Marketing in 2014 available online at 3. Why Facebook is losing its popularity, available online 4. Discovery Channel

Monday, October 14, 2013

What risks you run when you think you can manage?

Outsourcing and technology projects may come with a few risks, that can be managed, or mismanaged, it is your decision. Some people question the need for governance, failing to understand the deficiencies related to cultural issues, increased communication and co-ordination costs, lack of experience in managing technology, and, reliability. Recently, I had to involve the Police of Malta in recouping 500 EUR, paid as a deposit to a foreign-based software provider. The investigation goes on for months and all depends on the agreement of the beneficiary to return the funds once the funds have been deposited to his/her account. Therefore, if the beneficiary wanted to take the smartest position he would simply refused to return the monies, and, it is all perfectly legal, notwithstanding that the original contract of work was not honoured. This is not fair, and, one may question whether the costs of litigation are worth paying at this stage. Not sure if you want to ask the Malta Chamber of Advocates for their opinion. Taking out an insurance policy to cover the risk is not always possible, and, insurance comes at a cost as well, so one has to balance the risk-benefit of taking the risk against the risk of insuring the risk, if at all possible. Risk mitigation is an important branch of project management that deserves research on its own merits. Methodologies such as PRAM, and, software estimation methods such as COCOMO/COCOMO II allow for estimation of effort that takes into consideration effort, complexity based on the use of lines of code (or KLOC) to estimate the software development effort based on empirical evidence. If you feel that risk management, insurance and reliability are important factors to attain re-assurance of the quality of the delivery, you may drop me an email, and, we can meet for a coffee. Regards, Jonathan Camilleri IADCS
International corruption trends