zafienas / SSK3100-G14

0 stars 0 forks source link

4) Financial Application #22

Closed zafienas closed 3 years ago

zafienas commented 3 years ago

Problem Definition:

(Financial application: compute the future investment value) Write a method that computes future investment value at a given interest rate for a specified number of years. The future investment is determined using the formula in Programming Exercise 2.21 (Text book Liang).

Use the following method header:

public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years)

For example, futureInvestmentValue(10000, 0.05/12, 5) returns 12833.59.

Write a test program that prompts the user to enter the investment amount (e.g., 1,000) and the interest rate (e.g., 9%) and prints a table that displays future value for the years from 1 to 30, as shown below:

image

Submission:

  1. Java source code
  2. Screenshot of the output

Dateline : 15 January 2021

elyamaisarah commented 3 years ago
 //Developer: Elya Maisarah (202487)
//Task: Future Investment Value
import java.util.Scanner;
public class methodQ4 {
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate,int years) {
        return investmentAmount * Math.pow(1+monthlyInterestRate,years * 12 );
    }

    public static void main(String [] args) {
        Scanner input = new Scanner(System.in);
        final int NUM_OF_YEARS = 30;

        //user input
        System.out.println("Enter Investment Amount: ");
        double investmentAmount = input.nextDouble();
        System.out.println("Enter Interest Rate: ");
        double annualInterestRate = input.nextDouble();

        annualInterestRate = annualInterestRate / 100;
        double monthlyInterestRate = annualInterestRate / 12;

        System.out.println("Years"+"\t"+"Future Value");
            for (int years = 1; years <= NUM_OF_YEARS; years++) {
                System.out.printf("%-10d",years);
                System.out.printf("%6.2f\n",futureInvestmentValue(investmentAmount, monthlyInterestRate, years));

            }

    }
}

future investment 1 future investment2

nrhzrhrsli commented 3 years ago
//Developer : Nur Hazirah
//Task : Financial application

import java.text.DecimalFormat;
import java.util.Scanner;

public class Question4 {
    public static void main(String[] args){
        int numberOfYears = 30;
        int years;

        DecimalFormat decimal = new DecimalFormat("0.00") ;
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the investment amount : " );
        double investmentAmount = scanner.nextDouble();
        System.out.print("Annual interest rate : ");
        double annualinterestrate = scanner.nextDouble();

        annualinterestrate = annualinterestrate / 100;
        double monthlyinterestrate = annualinterestrate / 12;

        System.out.println("Years   Future value");
        for (years = 1; years <= numberOfYears; years++){
            //System.out.printf("%-10d", years);
            //System.out.printf("%11.2f\n", futureInvestmentValue(investmentAmount, monthlyinterestrate, years));
            System.out.print(years + "\t\t");
            System.out.println((decimal.format(futureInvestmentValue(investmentAmount,monthlyinterestrate, years))));
        }

    }
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate,int years){
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }

}

image

image

Syazimah06 commented 3 years ago
//Developer: SITI NUR SYAZIMAH BINTI ABU (203023)
//Task: compute the future investment value

import java.text.DecimalFormat;
import java.util.Scanner;
public class Question4 {
    public static void main(String[] args) {

        double interest, monthlyInterestRate;
        int numberOfyears;

        DecimalFormat df = new DecimalFormat("0.00");

        Scanner input = new Scanner(System.in);

        System.out.print("Investment amount: ");
        double investment = input.nextDouble();

        System.out.print("Enter the interest rate: ");
        interest = input.nextDouble();

        System.out.print("Years: ");
        numberOfyears = input.nextInt();

        interest = interest/100;
        monthlyInterestRate = interest / 12;

        System.out.println("Years     Future Value");
        for (int years = 1; years <= numberOfyears; years++){
            System.out.printf("%-10d", years);
            System.out.println(df.format (futureInvestmentValue(investment, monthlyInterestRate, years)));

        }
    }

    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years)
    {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 14);
    }
}

Finance1 Finance2

Masturah29 commented 3 years ago
//Developer : Masturah Biniti Mokhtar
//Task : Future Investment Value

import java.util.Scanner;

public class investmentCth {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in); // Create a Scanner
        final int NUMBER_OF_YEARS = 30; // Number of years to display

        // Prompt the user to enter the investment amount and interest rate
        System.out.print("\nThe amount invested: ");
        double amount = input.nextDouble();
        System.out.print("Annual interest rate: ");
        double annualInterestRate = input.nextDouble();

        // Get monthly interest rate
        double monthlyInterestRate = annualInterestRate / 1200;

        //Print a table that displays future value for the years from 1 to 30
        System.out.println("Years     Future Value (RM)"); // Table header
        for (int years = 1; years <= NUMBER_OF_YEARS; years++) {
            System.out.printf("%-10d", years);
            System.out.printf("%11.2f\n", futureInvestmentValue(amount, monthlyInterestRate, years));
        }
    }

    // Method futureInvestmentValue computes future investment value
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {

        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

invvvv

nadiahisml commented 3 years ago
//Developer: Nadiah Ismail
//Task: Display future value for the years from 1 to 30

import java.text.DecimalFormat;
import java.util.Scanner;

public class FutureInvestment {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        DecimalFormat df = new DecimalFormat("0.00");

        final int numOfYears = 30;

        System.out.print("The amount invested: ");
        double investmentAmount = input.nextDouble();
        System.out.print("Annual interest rate: ");
        double interestRate = input.nextDouble();

        double monthlyInterestRate = (interestRate / 100) / 12;

        System.out.println("Years       Future Value");
        for (int years = 1; years <= numOfYears; years++) {
            System.out.print(years + "\t");
            System.out.println("\t\t" + df.format(futureInvestmentValue(investmentAmount, monthlyInterestRate, years)));
        }

        //futureInvestmentValue(investmentAmount, monthlyInterestRate, numOfYears);

    }
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

image image

WanNurfarah commented 3 years ago

JAVA SOURCE CODE

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Financial Application Future Investment Value
import java.text.DecimalFormat;
import java.util.Scanner;

public class Investment {
    public static void main(String[] args) {

        //initialize
        int years = 30;
        double monthlyInterestRate;

        //request amount invested and annual interest rate from user
        Scanner scanner = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("0.00");

        System.out.print("The Amount Invested: ");
        double inv = scanner.nextDouble();

        System.out.print("Annual Interest Rate: ");
        double interest = scanner.nextDouble();

        //monthly interest rate formula
        monthlyInterestRate = (interest / 100) / 12;

        //invoke future investment value submethod
        futureInvestmentValue(inv, monthlyInterestRate, years);

        //print results
        System.out.println("Years    Future Value");
        for (int year = 1; year <= years; year++) {
            System.out.print(year + "\t\t\t");
            System.out.println(decimal.format(futureInvestmentValue(inv, monthlyInterestRate, year)));
        }
    }

        //future investment value submethod
        public static double futureInvestmentValue ( double investmentAmount, double monthlyInterestRate, int years){
            double FutureValue;
            FutureValue = investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
            return FutureValue;
        }
    }

OUTPUT fv

SorfinaNorly commented 3 years ago
//Developer: Norshasha Sorfina
//Task: Future Investment Rate
import java.text.DecimalFormat;
import java.util.Scanner;

public class Question4 {
    public static void main(String[] args) {

        int investmentAmount;
        int year = 30;
        double interestRate, monthlyInterestRate;

        DecimalFormat dc = new DecimalFormat("00.00");
        Scanner input = new Scanner(System.in);
        System.out.print("The Amount of Invented: ");
        investmentAmount = input.nextInt();
        System.out.print("Enter Rate of Interest: ");
        interestRate = input.nextDouble();

        monthlyInterestRate = ((interestRate / 100) / 12);

        System.out.println("Year\t\tFuture Value");
        for (int countYear = 1; countYear <= year; countYear++) {
            System.out.print(countYear + "\t\t\t");
            System.out.println(dc.format(futureInvestmentValue(investmentAmount, monthlyInterestRate, countYear)));
        }
    }
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate,int year){
        return investmentAmount * Math.pow(1 + monthlyInterestRate, year * 12);
    }

}

Q4a Q4b

FarhanaYusri commented 3 years ago

SOURCE CODE

//Developer: Farhana Yusri
//Task: Future Investment Value

import java.util.Scanner;
import java.text.DecimalFormat;

public class Main {

    public static void main(String[] args) {

         Scanner input = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("0.00") ;

        int investmentAmount, numberofyears = 30, futureInvestmentValue;
        double interest_rate,  monthlyinterestrate;

        System.out.print("Investment Amount : ");
        investmentAmount = input.nextInt();
        System.out.print("Annual Interest Rate : ");
        interest_rate = input.nextDouble();

        monthlyinterestrate = (interest_rate/100) / 12 ;

        System.out.println("Years     Future value");
        for (int years = 1; years <= numberofyears; years++){

            System.out.print(years + "\t");
            System.out.println("\t\t" + decimal.format(futureInvestmentValue(investmentAmount, monthlyinterestrate, years)));
        }

    }
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

OUTPUT

invest 1 invest 2

izzatisyahzanani16 commented 3 years ago

// Developer : Nurul Izzati Syahzanani
// Task : Financial Application

import java.lang.Math;
import java.text.DecimalFormat;
import java.util.Scanner;

public class FinancialApp {

    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {

        // futInvestAmount = investmentAmount * (Math.pow ((1 + monthlyInterestRate), (years * 12)));
        return investmentAmount * (Math.pow ((1 + monthlyInterestRate), (years * 12)));
    }

    public static void main(String[] args) {

        DecimalFormat decimal = new DecimalFormat("0.00");
        Scanner scanner = new Scanner(System.in);

        // double futInvestAmount = 0;
        int numberofyears = 30;
        int years;

        System.out.print("Enter Invest Amount : ");
        double investmentAmount = scanner.nextDouble();

        System.out.print("Enter Interest Rate : ");
        double InterestRate = scanner.nextDouble();

        double monthlyInterestRate = 0;
        monthlyInterestRate = (InterestRate / 100) / 12;

        System.out.println("Years         Future Value");
        for (years = 1; years <= numberofyears; years++) {
            System.out.print(years + "\t\t\t\t");
            System.out.println(decimal.format (futureInvestmentValue(investmentAmount, monthlyInterestRate, years)));
            //System.out.printf("%-10d" , years);
            //System.out.printf("%6.2f\n" , futureInvestmentValue(investmentAmount, monthlyInterestRate, years));
        }
    }
}

image image

NoorHusna202271 commented 3 years ago
// Developer: Noor Husna
//Task: Investment amount

import java.text.DecimalFormat;
import java.util.Scanner;

public class Latihantest4 {
    public static void main (String[] args){

        Scanner input = new Scanner(System.in);

        int Investment_amount, number_of_years;
        double interest_rate, montlyInterestrate, futureInvestmentValue;

        System.out.println(" Investment Amount:");
        Investment_amount = input.nextInt();
        System.out.println(" Annual interest rate:");
        interest_rate = input.nextDouble();
        System.out.println("Number of years");
        number_of_years = 30;

        montlyInterestrate = (interest_rate/100) /12;
        //futureInvestmentValue = Investment_amount * (1 + montlyInterestrate)^(number_of_years*12);

        System.out.println("Years  Future value");
        for ( int year=1; year <= number_of_years; year++){
            System.out.printf("%-10d", year);
            System.out.printf("%11.2f\n", futureInvestmentValue(Investment_amount ,montlyInterestrate, number_of_years));

        }
    }

    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years){
        return  investmentAmount * Math.pow( 1 + monthlyInterestRate, years *12 );
    }
}

image image

Farhanazul98 commented 3 years ago

Java Source Code

//developer: farhanazul
import java.text.DecimalFormat;
import java.util.Scanner;
public class Lab6Ques4 {
    public static void main(String[] args) {
        double amount, interest;
        int year;

        DecimalFormat decimal = new DecimalFormat("00.00");          //stating the decimal point

        Scanner want = new Scanner(System.in);                              //input user
        System.out.print("Amount Invested \t\t: " );
        amount = want.nextDouble();
        System.out.print("Annual Interest Rate \t: " );
        interest = want.nextDouble();
        System.out.print("Number of Years \t\t: " );
        year = want.nextInt();
        System.out.println("Years \t" + "Future Value");

        double monthlyInt = (interest / 100) / 12;

        for (int years = 1; years <= year; years++){                        //print the loop for years
            System.out.print(years + "\t\t");
            System.out.println(decimal.format(futureInvestmentValue(amount, monthlyInt, years)));

        }
    }
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years){
        double calculations;
        calculations = investmentAmount * Math.pow((1 + monthlyInterestRate), years * 12);

        return calculations;
    }
}

Output image

image

FtyRzd commented 3 years ago

SOURCE CODE

//Developer: Siti Nurfatihah bt Rozaidi 202934
//Task : Method Future Investment Value

import java.util.Scanner;
public class Q4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        double investmentAmount ;
        int year=30;
        double interest_rate;
        double monthlyinterestrate;

        System.out.println(" The Amount Invested: ");
        investmentAmount =input.nextInt();

        System.out.println(" Annual Interest Rate: ");
        interest_rate = input.nextDouble();

        monthlyinterestrate = interest_rate/1200;

        System.out.println(" Years      Future Value (RM) ");
        for (int years=1; years <= year; years++){
            System.out.printf(" %-10d" , years);
            System.out.printf(" %11.2f\n" , futureInvestmentValue(investmentAmount,monthlyinterestrate,years));

        }
    }

    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {

        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);

    }
}

OUTPUT image image

Lyanaazwanis99 commented 3 years ago
import java.text.DecimalFormat;
import java.util.Scanner;

//Developer: Lyana Azwanis
//Task: Financial application
public class latihan4method {

    public static double investmentValue(double investment, double monthlyinterestRate, int years) {

        //futureInvestmentamount = investment * (Math.pow ((1 + monthlyinterestRate), (years * 12)));
        return investment * (Math.pow((1 + monthlyinterestRate), (years * 12)));
    }
    public static void main(String[] args) {
        DecimalFormat decimal = new DecimalFormat("0.00");
        Scanner scanner = new Scanner(System.in);

        //double futureInvestmentamount = 0;
        int numOfyears = 30;
        int years;

        System.out.print("Enter Amount of Investment: ");
        double investment = scanner.nextDouble();
        System.out.print("Enter Interest Rate: ");
        double interestRate = scanner.nextDouble();
        double monthlyinterestRate = 0;
        monthlyinterestRate = (interestRate / 100) / 12;

        System.out.println("Years        Future value");
        for(years = 1; years <= numOfyears; years++) {
            System.out.print(years + "\t\t\t\t");
            System.out.println(decimal.format(investmentValue(investment, monthlyinterestRate, years)));
            //System.out.printf("%-10d" , years);
            //System.out.printf("%6.2f\n", investmentValue(investment, monthlyinterestRate, years));
        }
    }
}

https://prnt.sc/wm9gcc


https://prnt.sc/wm9gsp
fakhiraadriana commented 3 years ago
import java.text.DecimalFormat;
import java.util.Scanner;
public class soalan4 {
    //Developer name:Nur Fakhira Adriana
        public static void main ( String[]args){

        Scanner input = new Scanner(System.in); // Create a Scanner
             DecimalFormat decimal = new DecimalFormat("00.00");
        int numberOfyears = 30; // Number of years to display
        System.out.print("\nThe amount invested: ");
        double amount = input.nextDouble();
        System.out.print("Annual interest rate: ");
        double annualInterestRate = input.nextDouble();

        // Get monthly interest rate
        double monthlyInterestRate = annualInterestRate / 1200;

        // Print a table that displays future value for the years from 1 to 30
        System.out.println("Years   Future Value"); // Table header
        for (int years = 1; years <= numberOfyears; years++) {
       // System.out.printf("%-10d", years);//-ve untuk ke kiri +ve ke kanan.d tu double kekadang leh i
        // System.out.printf("%11.2f\n", futureInvestmentValue(amount, monthlyInterestRate, years));
            System.out.print(years+"\t\t");
            System.out.println(decimal.format(futureInvestmentValue(amount, monthlyInterestRate, years)));
        //11.2f is perpuluhan and -10d tu jarak antara years and future value. f tu
                    // untuk decimal float sebabtu letak nilai after f tu
    }
}

    /** Method futureInvestmentValue computes future investment value */
        public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

Screenshot (243) Screenshot (244)

NurHanisHaziqah commented 3 years ago
//Developer: Nur Hanis Haziqah Binti Hisham Haizad (202936)
//Task : Financial Status

package com.company;

import java.text.DecimalFormat;
import java.util.Scanner;

public class Question4 {
    public static void main(String[] args) {
        int years = 30;
        double investmentAmount;
        double annualInterestRate;
        double monthlyInterestRate;

        Scanner input = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("00.00");

        // Prompt the user to enter the investment amount and interest rate
        System.out.print("\nEnter Investment Amount: ");
        investmentAmount = input.nextDouble();
        System.out.print("Enter Annual Interest Rate: ");
        annualInterestRate = input.nextDouble();

        // Get monthly interest rate
        monthlyInterestRate = (annualInterestRate/100 )/ 12;

        System.out.println(" Years"+"\t"+"Future Value");
        for (int i = 1; i <=years; i++) {
            System.out.print(i+"\t\t");
            System.out.println(decimal.format(futureInvestmentValue(investmentAmount, monthlyInterestRate,i)));
        }
    }

    /** Method futureInvestmentValue computes future investment value */
    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {

        return investmentAmount * (Math.pow((1 + monthlyInterestRate), (years * 12)));
    }
}

Screenshot_177 Screenshot_178

azeelahyasmin00 commented 3 years ago
// Developer : Azeelah Yasmin Bt Azlee
// No.Matrik : 202935

import java.util.Scanner;

public class Q4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in); // Create a Scanner
        final int NUMBER_OF_YEARS = 30; // Number of years to display

        // Prompt the user to enter the investment amount and interest rate
        System.out.print("\nThe amount invested: ");
        double amount = input.nextDouble();
        System.out.print("Annual interest rate: ");
        double annualInterestRate = input.nextDouble();

        // Get monthly interest rate
        double monthlyInterestRate = annualInterestRate / 1200;

        System.out.println("Years Future Value");
        for (int years = 1; years <= NUMBER_OF_YEARS; years++) {
            System.out.printf("%-10d", years);
            System.out.printf("%11.2f\n",
                    futureInvestmentValue(amount, monthlyInterestRate, years));
        }
    }

    /** Method futureInvestmentValue computes future investments value */
    public static double futureInvestmentValue(
            double investmentAmount, double monthlyInterestRate, int years) {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

image image

haswani203024 commented 3 years ago
//DEVELOPER: NURUL HASWANI BINTI ARIFFIN 
//MATRIC NO:203024

import java.util.Scanner;
public class no4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        final int NUMBER_OF_YEARS = 30;

        System.out.print("\nThe amount invested: ");
        double amount = input.nextDouble();
        System.out.print("Annual interest rate: ");
        double annualInterestRate = input.nextDouble();

        double monthlyInterestRate = annualInterestRate / 1200;

        System.out.println("Years Future Value");
        for (int years = 1; years <= NUMBER_OF_YEARS; years++) {
            System.out.printf("%-10d", years);
            System.out.printf("%11.2f\n",
                    futureInvestmentValue(amount, monthlyInterestRate, years));
        }
    }

    public static double futureInvestmentValue(
            double investmentAmount, double monthlyInterestRate, int years) {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);
    }
}

image

image

arifqhuzairie commented 3 years ago
//Developer = Arif Qhuzairie
//Task = financial application

import java.text.DecimalFormat;
import java.time.Year;
import java.util.Scanner;

public class finappli {
    public static void main(String[] args) {
        double interest, monthly_interestrate;
        int numberofyear;

        DecimalFormat df = new DecimalFormat("0.00");

        Scanner input = new Scanner(System.in);

        System.out.print("Investment amount: ");
        double investment = input.nextDouble();

        System.out.print("Enter the interest rate: ");
        interest = input.nextDouble();

        System.out.print("Years: ");
        numberofyear = input.nextInt();

        interest = interest/100;
        monthly_interestrate = interest/12;

        System.out.println("Year      Future value");
        for (int year = 1; year <= numberofyear; year++){
            System.out.printf("%-10d", year);
            System.out.println(df.format (futureinvestmentvalue(investment,monthly_interestrate,year)));

        }
    }

    public static double futureinvestmentvalue(double investmentamount, double monthly_interestrate, int year){
        return investmentamount * Math.pow(1+ monthly_interestrate, year * 12);
    }
}

image

DenzKaizer commented 3 years ago
//Developer: MUHAMMAD DANISH ASYHRAF BIN SHAHARUDIN (204596)
//Task: Financial Application

import java.text.DecimalFormat;
import java.util.Scanner;

        public class Lab6_4 {
        public static void main(String[] args) {

            double interest, monthlyInterestRate;
            int numberOfyears;

            DecimalFormat df = new DecimalFormat("0.00");

            Scanner input = new Scanner(System.in);

            System.out.print("Investment amount: ");
            double investment = input.nextDouble();

            System.out.print("Enter the interest rate: ");
            interest = input.nextDouble();

            System.out.print("Years: ");
            numberOfyears = input.nextInt();

            interest = interest / 100;
            monthlyInterestRate = interest / 12;

            System.out.println("Years     Future Value");
            for (int years = 1; years <= numberOfyears; years++) {
                System.out.printf("%-10d", years);
                System.out.println(df.format(futureInvestmentValue(investment, monthlyInterestRate, years)));

            }
        }

        public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) {
            return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 14);
        }
    }

Screenshot_6

ikmalhafiq commented 3 years ago

//Developer = Ikmal Hafiq
//Task = Future Investment Value

import java.text.DecimalFormat;
import java.time.Year;
import java.util.Scanner;

public class FinancialApp {
    public static void main(String[] args) {
        double interest, monthly_interestrate;
        int numberofyear;

        DecimalFormat df = new DecimalFormat("0.00");

        Scanner input = new Scanner(System.in);

        System.out.print("Investment amount: ");
        double investment = input.nextDouble();

        System.out.print("Enter the interest rate: ");
        interest = input.nextDouble();

        System.out.print("Years: ");
        numberofyear = input.nextInt();

        interest = interest/100;
        monthly_interestrate = interest/12;

        System.out.println("Year      Future value");
        for (int year = 1; year <= numberofyear; year++){
            System.out.printf("%-10d", year);
            System.out.println(df.format (futureinvestmentvalue(investment,monthly_interestrate,year)));

        }
    }

    public static double futureinvestmentvalue(double investmentamount, double monthly_interestrate, int year){
        return investmentamount * Math.pow(1+ monthly_interestrate, year * 12);
    }
}

financial app 1 financial app 2

AzimArifin commented 3 years ago

//Developer = Muhammad Azim Arifin bin Mohd Azilan (200670)
//Task = Future Investment Value

import java.text.DecimalFormat;
import java.time.Year;
import java.util.Scanner;

public class Main7 {
    public static void main(String[] args) {
        double interest, monthly_interest_rate;
        int numberof_year;

        DecimalFormat df = new DecimalFormat("0.00");

        Scanner input = new Scanner(System.in);

        System.out.print("Amount of Investment: ");
        double investment = input.nextDouble();

        System.out.print("Enter the interest rate: ");
        interest = input.nextDouble();

        System.out.print("Years: ");
        numberof_year = input.nextInt();

        interest = interest/100;
        monthly_interest_rate = interest/12;

        System.out.println("Year      Future value");
        for (int year = 1; year <= numberof_year; year++){
            System.out.printf("%-10d", year);
            System.out.println(df.format (futureinvestmentvalue(investment,monthly_interest_rate,year)));

        }
    }

    public static double futureinvestmentvalue(double investmentamount, double monthly_interestrate, int year){
        return investmentamount * Math.pow(1+ monthly_interestrate, year * 12);
    }
}
AzimArifin commented 3 years ago

Screenshot_4 Screenshot_5

ajim1619 commented 3 years ago

//developer: Abdul Azim (203198)
//task: Financial Applications

import java.text.DecimalFormat;
import java.time.Year;
import java.util.Scanner;

    public class FinanceApps {
        public static void main(String[] args) {
            double interest, monthly_interest_rate;
            int numberof_year;

            DecimalFormat df = new DecimalFormat("0.00");

            Scanner input = new Scanner(System.in);

            System.out.print("Amount of Investment: ");
            double investment = input.nextDouble();

            System.out.print("Enter the interest rate: ");
            interest = input.nextDouble();

            System.out.print("Years: ");
            numberof_year = input.nextInt();

            interest = interest/100;
            monthly_interest_rate = interest/12;

            System.out.println("Year      Future value");
            for (int year = 1; year <= numberof_year; year++){
                System.out.printf("%-10d", year);
                System.out.println(df.format (futureinvestmentvalue(investment,monthly_interest_rate,year)));

            }
        }

        public static double futureinvestmentvalue(double investmentamount, double monthly_interestrate, int year){
            return investmentamount * Math.pow(1+ monthly_interestrate, year * 12);
        }
    }

Result

shazmi10 commented 3 years ago
// Developer: Muhammad Shazmi Bin Mohd Basri
// Task: Print a future value

import java.text.DecimalFormat;
import java.util.Scanner;

public class FInancialApplication {
    public static void main(String[] args){
        int numberOfYears = 30;
        int years;

        DecimalFormat decimal = new DecimalFormat("0.00") ;
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the investment amount : " );
        double investment = scanner.nextDouble();
        System.out.print("Annual interest rate : ");
        double annualInterestRate = scanner.nextDouble();

        annualInterestRate = annualInterestRate / 100;
        double monthlyInterestRate = annualInterestRate / 12;
        System.out.println("Years     Future Value");
        for ( years = 1; years <= numberOfYears; years++){
            System.out.printf("%-10d", years);
            System.out.println(decimal.format (futureInvestmentValue(investment, monthlyInterestRate, years)));

        }
    }

    public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years)
    {
        return investmentAmount * Math.pow(1 + monthlyInterestRate, years * 14);
    }
}

image

Yazidrahman commented 3 years ago

image

image

//developer yazid rahman
// task : future value
import java.text.DecimalFormat;
import java.time.Year;
import java.util.Scanner;

public class labfuturevalue {
            public static void main(String[] args) {
            double interest, monthly_interestrate;
            int numberofyear;

            DecimalFormat df = new DecimalFormat("0.00");

            Scanner input = new Scanner(System.in);

            System.out.print("Investment amount: ");
            double investment = input.nextDouble();

            System.out.print("Enter the interest rate: ");
            interest = input.nextDouble();

            System.out.print("Years: ");
            numberofyear = input.nextInt();

            interest = interest/100;
            monthly_interestrate = interest/12;

            System.out.println("Year      Future value");
            for (int year = 1; year <= numberofyear; year++){
                System.out.printf("%-10d", year);
                System.out.println(df.format (futureinvestmentvalue(investment,monthly_interestrate,year)));

            }
        }

        public static double futureinvestmentvalue(double investmentamount, double monthly_interestrate, int year){
            return investmentamount * Math.pow(1+ monthly_interestrate, year * 12);
        }
    }