Java Programming

Only available on StudyMode
  • Download(s) : 58
  • Published : March 27, 2013
Open Document
Text Preview
Index

| | | | |Introduction………………………………………………2 | |Problem 1 ………………………………………………..3 | |Problem 2………………………...……………………….5 | |Conclusion ……………………………………….………9 | |Appendices………………………………………………11 |

I Introduction

Java is a programming language originally released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere". Java is currently one of the most popular programming languages in use, and is widely used from application software to web applications.

Moreover, Swing is the primary Java GUI widget toolkit. It is part of Sun Microsystems' Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform.

Base on our long experience programming using C and C++, we tried to do more work than the others whom came from different background. We came up with to solutions for the first problem, and exactly outputs for the second problem. However, discovering Swing GUI which has many features and userfriend interface. Programming using Swing GUI java was the most intresting in our assignment.

I I Problem 1: (6 marks)

Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value.

To write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the console is really sample. Especially, when we already have the main function “FV = PV * [1 + ((r/100)/12)] ^ n”, and as we have defined the parameters as: o FV = future value of investment

o PV = investment amount
o r = monthly interest rate
o n = number of months
Here our first solution, the code and the output display:
|[pic] |

We preferred to use swing GUI forms. It is much better and than working with the console. We used textboxes to allow user enters future investment amount and monthly interest rate and the number of months or years.

However, we used combo box to switch between calculating by years or months which is allow the...
tracking img