Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program the meets the conditions as described below. You will need to di

ID: 3537794 • Letter: W

Question

Write a program the meets the conditions as described below. You will need to display a menu of options that the user can choose from. Make sure that you code includes you name, class, section, date and a brief description as a comment header. Also be sure that your code included comments.

The menu can be constructed as something similar to the below example:

//////////////////////////////////////////////////////////////////////////////

Welcome to Financial Program   

1. Compare Loan Rates

2. Print Shapes

/////////////////////////////////////////////////////////////////////////////

For Option 1, construct a program that lets the user enter the loan amount and loan period in number of years, and displays the monthly and total payments for each interest rate starting from 5% to 8% with an increment of 1/8. Supposed you enter the loan amount 10,000 for five years; display a table as follows:

Loan Amount: 10000

Number of years: 5

Interest Rate Monthly Payment Total Payment

5% 188.71 11322.74

5.125% 189.28 11357.13

5.25% 189.85 11391.59

%u2026

7.875% 202.17 12129.97

8.0% 202.76 12165.84


For Option 2, display the following shapes automatically, when this option is chosen from the menu: The total max value should be entered by the user. This example max is 6

Pattern1 Pattern 2 Pattern3 Pattern4

1 123456 1 123456

12 12345 21 12345

123 1234 321 1234

1234 123 4321 123

12345 12 54321 12

123456 1 654321 1


Explanation / Answer

please rate - thanks

figured it out--any probles I'll fix

sample run


----jGRASP exec: java main

Welcome to Financial Program
//////////////////////////////////////////////////////////////////
1.   Compare Loan Rates
2.   Print Shapes
3.   exit
2
Enter max numbers: 6
pattern 1
1
12
123
1234
12345
123456

pattern 2
123456
12345
1234
   123
    12
     1

pattern 3
123456
12345
1234
123
12
1

pattern 4
     1
    21
   321
4321
54321
654321
Welcome to Financial Program
//////////////////////////////////////////////////////////////////
1.   Compare Loan Rates
2.   Print Shapes
3.   exit
1
Loan Amount: 10000
Number of years: 5
Interest Rate    Monthly Payment    Total Payment
5.000%        188.71        11322.74
5.125%        189.29        11357.13
5.250%        189.86        11391.59
5.375%        190.44        11426.11
5.500%        191.01        11460.70
5.625%        191.59        11495.35
5.750%        192.17        11530.06
5.875%        192.75        11564.84
6.000%        193.33        11599.68
6.125%        193.91        11634.59
6.250%        194.49        11669.56
6.375%        195.08        11704.59
6.500%        195.66        11739.69
6.625%        196.25        11774.85
6.750%        196.83        11810.08
6.875%        197.42        11845.37
7.000%        198.01        11880.72
7.125%        198.60        11916.14
7.250%        199.19        11951.62
7.375%        199.79        11987.16
7.500%        200.38        12022.77
7.625%        200.97        12058.44
7.750%        201.57        12094.18
7.875%        202.17        12129.97
8.000%        202.76        12165.84
Welcome to Financial Program
//////////////////////////////////////////////////////////////////
1.   Compare Loan Rates
2.   Print Shapes
3.   exit
3

----jGRASP: operation complete.

------------------------------------------------------------------------------------

import java.util.*;
public class main
{public static void main(String[] args)
{Scanner in=new Scanner(System.in);
int choice;
do
{choice=menu(in);
if(choice==1)
      loan(in);
else if(choice==2)
      shapes(in);
else if(choice!=3)
      System.out.println("invalid choice");
}while(choice!=3);
}
public static int menu(Scanner in)
{//System.out.println("//////////////////////////////////////////////////////////////////");                                            Welcome to Financial Program ";                                   
System.out.println("Welcome to Financial Program");
System.out.println("//////////////////////////////////////////////////////////////////");

int n;
System.out.println("1.   Compare Loan Rates");   
System.out.println("2.   Print Shapes");
System.out.println("3.   exit");
n=in.nextInt();
return n;
}
public static void loan(Scanner in)
{double amt, month,total,rate,r;
int years,i;
System.out.print("Loan Amount: ");
amt=in.nextDouble();
System.out.print("Number of years: ");
years=in.nextInt();
System.out.println("Interest Rate Monthly Payment Total Payment");
for(rate=5;rate<=8;rate+=1./8.)
     {r=rate/100/12.;
       month=amt*r/(1-(Math.pow(1/(1+r),years*12)));
        total=0;
        for(i=0;i<12*years;i++)
            total+=month;
        System.out.printf("%.3f%% %.2f %.2f ",rate,month,total);
    }

}
public static void shapes(Scanner in)
{int i,j,max;
System.out.print("Enter max numbers: ");
max=in.nextInt();
System.out.println("pattern 1");
for(i=1;i<=max;i++)
     {for(j=1;j<=i;j++)
           System.out.print(j);
        System.out.println();
        }

System.out.println(" pattern 2");
for(i=max;i>=1;i--)
     {for(j=1;j<=max-i;j++)
           System.out.print(" ");
       for(j=1;j<=i;j++)
           System.out.print(j);
        System.out.println();
        }

System.out.println(" pattern 3");
for(i=max;i>=1;i--)
     {for(j=1;j<=i;j++)
           System.out.print(j);
        System.out.println();
        }


System.out.println(" pattern 4");
for(i=1;i<=max;i++)
     {for(j=1;j<=max-i;j++)
           System.out.print(" ");
       for(j=i;j>=1;j--)
           System.out.print(j);
        System.out.println();
        }


}
    }


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote