Need help with my JAVA homework ASAP thank you so much The c
Need help with my JAVA homework ASAP, thank you so much.
The cost this year (2016) of a car is $25000. Each year the cost increases by 6.5%. Write a Java program that asks you to type a number (say N) representing a time period in years. The program then prints the cost of the car yearly for N years starting in 2016. The program must use a while loop to compute and print the results. You need not concern yourself with the exact display of the decimal point. Test this program with two different numbers of years. The program works as follows:Solution
JAVA PROGRAM:-
import java.util.Scanner;
public class costIncrement {
    public static void main(String args[]) {
        Scanner in=new Scanner(System.in);
        System.out.println(\"Please type a number of Years:\");
        int n=in.nextInt();
        int year=2016;
            double cost=25000;
            double rate=0.065;
            System.out.println(\"Year: \" + year + \" - Cost \" + cost);
            while(n-- >0){
                cost= cost+ (cost*rate);
                year++;
                System.out.println(\"Year: \" + year + \" - Cost \" + cost);
            }
 }
 }
Test Case 1:
Please type no of Years:10
 Year: 2016 - Cost 25000.0
 Year: 2017 - Cost 26625.0
 Year: 2018 - Cost 28355.625
 Year: 2019 - Cost 30198.740625
 Year: 2020 - Cost 32161.658765624998
 Year: 2021 - Cost 34252.16658539062
 Year: 2022 - Cost 36478.55741344101
 Year: 2023 - Cost 38849.66364531468
 Year: 2024 - Cost 41374.891782260136
 Year: 2025 - Cost 44064.25974810705
 Year: 2026 - Cost 46928.436631734
TEST CASE 2:-
Please type no of Years:20
 Year: 2016 - Cost 25000.0
 Year: 2017 - Cost 26625.0
 Year: 2018 - Cost 28355.625
 Year: 2019 - Cost 30198.740625
 Year: 2020 - Cost 32161.658765624998
 Year: 2021 - Cost 34252.16658539062
 Year: 2022 - Cost 36478.55741344101
 Year: 2023 - Cost 38849.66364531468
 Year: 2024 - Cost 41374.891782260136
 Year: 2025 - Cost 44064.25974810705
 Year: 2026 - Cost 46928.436631734
 Year: 2027 - Cost 49978.78501279671
 Year: 2028 - Cost 53227.4060386285
 Year: 2029 - Cost 56687.18743113935
 Year: 2030 - Cost 60371.85461416341
 Year: 2031 - Cost 64296.02516408403
 Year: 2032 - Cost 68475.26679974949
 Year: 2033 - Cost 72926.15914173321
 Year: 2034 - Cost 77666.35948594587
 Year: 2035 - Cost 82714.67285253236
 Year: 2036 - Cost 88091.12658794696
TEST CASE 3:
Please type no of Years: 30
 Year: 2016 - Cost 25000.0
 Year: 2017 - Cost 26625.0
 Year: 2018 - Cost 28355.625
 Year: 2019 - Cost 30198.740625
 Year: 2020 - Cost 32161.658765624998
 Year: 2021 - Cost 34252.16658539062
 Year: 2022 - Cost 36478.55741344101
 Year: 2023 - Cost 38849.66364531468
 Year: 2024 - Cost 41374.891782260136
 Year: 2025 - Cost 44064.25974810705
 Year: 2026 - Cost 46928.436631734
 Year: 2027 - Cost 49978.78501279671
 Year: 2028 - Cost 53227.4060386285
 Year: 2029 - Cost 56687.18743113935
 Year: 2030 - Cost 60371.85461416341
 Year: 2031 - Cost 64296.02516408403
 Year: 2032 - Cost 68475.26679974949
 Year: 2033 - Cost 72926.15914173321
 Year: 2034 - Cost 77666.35948594587
 Year: 2035 - Cost 82714.67285253236
 Year: 2036 - Cost 88091.12658794696
 Year: 2037 - Cost 93817.0498161635
 Year: 2038 - Cost 99915.15805421413
 Year: 2039 - Cost 106409.64332773804
 Year: 2040 - Cost 113326.27014404102
 Year: 2041 - Cost 120692.47770340368
 Year: 2042 - Cost 128537.48875412492
 Year: 2043 - Cost 136892.42552314303
 Year: 2044 - Cost 145790.43318214733
 Year: 2045 - Cost 155266.8113389869
 Year: 2046 - Cost 165359.15407602105


