You are on page 1of 8

MITS4002 OBJECT ORIENTED

SOFTWARE DEVELOPMENT -
ACTIVITY 03
Content

s
Introduction......................................................................................................................................3

Design..............................................................................................................................................4

Coding..............................................................................................................................................5

Output..............................................................................................................................................6

Testing.............................................................................................................................................7

References........................................................................................................................................8

Figures
Figure 1: Successfully calculate future investment value................................................................6

Figure 2: future investment value for two years..............................................................................6

Figure 3: Generate error in a decimal set of value...........................................................................7

Figure 4: Generate error in the wrong format of year.....................................................................7


Introduction
In this assignment, we will discuss the understanding of the oriented approach include using the
practical approach with code designing of calculating the future investment value. It will develop
the skill to solve line of codes and correct implementation is shown according to the output set.
Design
This step includes the knowledge regarding the challenge before solving any problem and
gathering which includes the vision in which it consists of the problem specifications including
the type and the approach can be solved. After breaking the design into small parts, the big
problem like future investment value calculation will be easy to solved. Designed the pseudo-
code for the program initially before performing the actual set of coding like as:

Start
Month = Year x 12
Applying formula
monthRateofInterest= yearRateofInterest / 12 / 100
fValue = CalFValue (AmountInvested, monthRateofInterest, Month)
print "Accumlated Value $", fValue
calculating
Num CalFValue (num mInvestment, num monthRateofInterest, num Month)
Num fValue = 0
Num mcount=0
start while
while mcount < Month
fValue = (fValue + mInvestment) x (1 + monthRateofInterest)
mcount = mcount + 1
end while
return fValue
Hence, this produces the abstract coding problem which should be solved by doing this in IDE as
java code.
Coding
import java.text.*;

import java.util.Scanner;

public class Accumlated {

Private static DecimalFormat done = new DecimalFormat("#.##"); // rounded up


the value to the //two place

public static void main (String[] args) {

Scanner inp= new Scanner (System.in);

System.out.println ("Please enter amount of Investment: "); // take input of


investment amount

double investAmo= inp.nextInt();

System.out.println ("Please enter interest rate annually: "); // take input of


annual rate of interest

double annualintrate= inp.nextDouble();

System.out.println ("Please enter the year: "); // take input of the years

int yea =inp.nextInt();

double monthlyrateinterest= (annualintrate)/1200; // gather rate of interest


on monthly bases

double futureinvestvalue=investAmo*Math.pow(1+monthlyrateinterest,yea*12);
//calculate //interest value for future

System.out.println ("The Final value is $" + done.format (futureinvestvalue));


// display final //accumulated value

}}
Output
The output which should be displayed for successful calculation of the value of future investment
term by the given set of the equation:

Figure 1: Successfully calculate future investment value

Figure 2: future investment value for two years


Testing
The phase of testing includes the importance after the successful development of the code and
the generation of the output, to check the code in the all the situations:

1. Input the decimal format of the investment amount like: -

Figure 3: Generate error in a decimal set of value

2. Provide the wrong format in the year as input then, it generates the following output: -

Figure 4: Generate error in the wrong format of year


References
Javaworld, 2020. Introduction to design Techniques [Online] Available at:
https://www.javaworld.com/article/2076601/introduction-to--design-techniques-.html. [Accessed
8 April 2020].

You might also like