M255 Java Calculator

M255 Java Calculator

Having completed the Open University course M255 I decided I wanted to put my new found knowledge to use. I needed a project, and wanted to learn about how user interfaces are programmed in Java.

A Calculator seemed like a good project, but I set myself a few restrictions, they were;

  • Not allowed to use an ‘Integrated Development Environment’, I used the VI text editor instead.
  • Use compiler (javac) and Java Virtual Machine (java) to run it from the command line.
  • Not allowed to look at how other people had programmed a calculator
  • The only source of help was my knowledge of Java from M255, and, The Java Tutorials at the Sun website.

One of the reasons for putting the details of the project on the web was to show others what can be achieved after completing M255, and to welcome feedback from people, including experienced developers.

Source and Design

This project has been split into phases to make development more manageable within the limited time I have. Initialy I wanted to create a user interface that responded to all the events I needed and then make it work like a calculator. What surprised me was that it only took an hour and a half to create the user interface, being that I am no expert means I have probably not implemented it as well as I could have, but thats why ive signed up for M257.

Version Description Classes
v1.0
29th October 2006
Original version with basic calculator features Calculator
Calculation

Instructions

Future enhancements

As anyone working in software development knows, programs always evolve, and the Calculator is no different, I see the code/implementation changing as I receive comments from more experienced Java developers, and to add the following;

  • Convert into an Applet so people can see the Calculator on the web without having to download it and run it locally.
  • Add support for keyboard use, at present this is purely mouse driven.
  • Nested brackets
  • Improve the layout of the interface, it could look better.
  • Add other scientific functions, maybe even graphs as I get really adventurous.
  • … and more as either I think of them or people suggest them.

Warning!

As I am no expert on Java or Java user interfaces I obviously have no idea if there is a better way of achieving what I want, or for that matter if I have committed any sins in the code I have created; however, I hope this project evolves and can become a case study tracing the evolution of the calculator from the original source (v1.0) through it’s evolution into a more show case calculator program.

This is a purely educational project; I don’t see this being of any real use to any one other than to learn from.

15 Responses to “M255 Java Calculator”

  1. Hi,

    i have been searching the Web for information about M255, and found your Website.

    I see that you have passed M255, and i am wishing to study M255 this year with the OU and it will be very nice from you if you could answer my following question:

    I know that M255 ends with Examination; Can you tell me some details about this Exam? Is it computer based exam or just Paper/Pen? If it is Paper-based, then it will be some kind of strange to me, because i can not imagine that somebody will ask me to write a Program on Paper( without PC, IDE…. ).

    Was there any multiple-choice question, or you have to write everything from scratch?

    I will be very happy if you can provide me just with one sample question.

    Thanks.

  2. Hi Alan,

    Thanks for taking the time to visit my site, sorry I wasn’t able to reply more quickly.

    The exam is paper/pen based, fortunantly you don’t have to write whole programs. You will have to write parts of classes and there is a multiple choice section. Rember of course some time has passed since I finished the course. It might have changed.

    The writing isn’t that bad, especially if you do some revision that includes writing code on paper. The writing angle in revision will help to remember things better because your using more of yourself, your kmore engaged so it’s more effective, also you will find you will build up your muscles and stamina in your hand for writing in the exam.

    Does that help? in terms of example questions, its best to get the examples from the OU, I think they are a couple of quid and you get an entire past exam paper. When I did the course there hand’t been any past exam papers, but they did create some sample ones for us.

    I would say do the course and if you put the effort in you will pass :-) and the exam goes very quick.

    All the best
    Russell

  3. Hey,

    I’m starting M255 this october and having found Java really hard to pick up before when i’ve tried to teach myself it, your project has given me enthusiasm to keep at it.

    I’d love to be able to learn to create my own programs.

    I found your writing really interesting. Thank you.

    If you or anyone else doing M255 wishes to speak with me, add me on Facebook: Http://www.facebook.com/geon106

  4. Hey, I have been looking for reviews of writers, and after hunting through the search engines, I landed your blog, it really islovely article. Sad I took this long to get to read this article. Bookmarked you already. I shall return soon. Just keep on writing you will get loads of followers.

  5. I would like toconfessyour entire articles are of great helpsince they bestowgood advices.Wishing u all the best for your upcoming writings and hope they too will help me like this one.

  6. You completed various good points there. I did a search on the subject and found most people will go along with with your blog.

  7. Regards for sharing a person’s stuff on weblog. It is doubtless that we have similar pursuits. Something are worth finding out about to me.

  8. Hello there, You’ve done an excellent job. I will definitely digg it and personally suggest to my friends. I am confident they will be benefited from this site.

  9. I admire your work , thank you for all the interesting posts .

  10. Your blog has inspired me to really completely change the way I write. I have to tell you I appreciate your hard work.

  11. I found this blog in forum businees and I’m very interested in this topic.
    I’m from Slovakia and I read many publication about it. I thought idea of article is quite best and impresive to think about this entertainment and future.Kind regards from England .

  12. Hello, you used to write magnificent, but the last few posts have been kinda boring¡K I miss your super writings. Past few posts are just a little out of track! come on!

  13. Hi, I found your blog via Google while searching for Nikki Cox Gallery and your post regarding s 2007 Movie Awards! looks very interesting for me.

  14. Hi Carrol,

    Thanks for the feedback, can you be more specific about what you like? I will see what I can do :-)

  15. you’re really a good webmaster. The site loading speed is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterpiece. you’ve done a excellent job on this topic!

Leave a Reply