Login|Contact Us
Question and Answer

Programming

Ask a Programming Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

Complete SR-mf-003 Change Request 7. Insert comments to document

 

Customer Question

Complete SR-mf-003 Change Request 7. Insert comments to document the program. Attach a design flow chart to the program’s source code.

 

Optional Information:
Computer OS: Windows Vista
Browser: IE

Already Tried:
nothing, don't know how to start.iam lost.

Submitted: 1350 days and 18 hours ago.
Category: Programming
Value: $22
Status: CLOSED
Picture
Expert:  Rafael Martins replied 1348 days and 15 hours ago.

Hi there.

I saw that you have posted this project in another website...
Could you explain your situation a little more?

Rafael.

Customer replied 1348 days and 15 hours ago.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.awt.event.ActionListener;

public class RobertWK5 extends JPanel implements ActionListener {

//Serial Version ID
private static final long serialVersionUID = 1L;
// arrays
String[] loan = {"7 yrs @ 5.35%", "15 yrs @ 5.5%", "30 yrs @ 5.75%", "Select one"};
int[] term = {7, 15, 30};
double[] apr = {5.35, 5.5, 5.75};
int graphAngle = 0;// Graph

//loan values
private double loanAmount;
private int loanIndex;

//Labels and their fields
private JLabel loanAmountLabel = new JLabel("Loan Amount: ");
private JLabel monthlyPaymentLabel = new JLabel("Monthly Payments: ");
private JLabel loanLabel = new JLabel("Customized Input: ");
private JLabel termLabel = new JLabel(" Term in years: ");
private JLabel aprLabel = new JLabel(" Interest: ");
private JLabel schedulePayLabel = new JLabel("Payment# New Balance Interest Paid");
//Formats to format and parse numbers
private NumberFormat loanAmountFormat;
private NumberFormat monthlyPaymentFormat;
private NumberFormat termFormat;
private NumberFormat aprFormat;

//Fields for user input and output
private JFormattedTextField loanAmountField;
private JComboBox loanList;
private JFormattedTextField monthlyPaymentField;
private JFormattedTextField termField;
private JFormattedTextField aprField;

//Text field for scheduled payments with scroll pane
JTextArea scheduleTextArea = new JTextArea();
JScrollPane scheduleScrollPane1 = new JScrollPane(scheduleTextArea);

//Menu for clear and exit
JMenuBar myMenuBar = new JMenuBar();
JMenu myMenu = new JMenu("Menu");
JMenuItem calcMenuItem = new JMenuItem("Calculate");
JMenuItem clearMenuItem = new JMenuItem("Clear");
JMenuItem exitMenuItem = new JMenuItem("Exit");

//Buttons
JButton button1 = new JButton("Calculate");

//Panels and grids
JPanel outerPanel = new JPanel(new GridLayout(4,0));
JPanel innerPanel = new JPanel(new BorderLayout());
JPanel myPanel = new JPanel(new GridLayout(3,4));
JPanel buttonPanel = new JPanel(new BorderLayout());
JPanel myChart = new JPanel();
//Graph frame
JFrame graphFrame = new JFrame("Graph");
//constructor Add GUI items
public RobertWK5() {

KeyAdapter myKeyAdapter = new KeyAdapter(){
public void keyTyped(KeyEvent arg0)
{
char key = arg0.getKeyChar();
//Allows numbers and dots
if (!(Character.isDigit(key) || (key == KeyEvent.VK_PERIOD) ||
(key == KeyEvent.VK_BACK_SPACE) || (key == KeyEvent.VK_DELETE)))
{
arg0.consume();
}
if (loanIndex < 3)
{
if (aprField.isFocusOwner() || termField.isFocusOwner())
{
arg0.consume();
popupError(" Select the plan ");

}
}
}
};
//Action listener and comboBox
ActionListener myLoanListListener = new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JComboBox combo = (JComboBox)arg0.getSource();
loanIndex = combo.getSelectedIndex();
if (loanIndex < 3)
{
termField.setValue(0);
termField.setText("");
aprField.setValue(0);
aprField.setText("");
}
}
};
//menu
calcMenuItem.addActionListener(this);
calcMenuItem.setActionCommand("Calculate");
clearMenuItem.addActionListener(this);
clearMenuItem.setActionCommand("Clear");
exitMenuItem.addActionListener(this);
exitMenuItem.setActionCommand("Exit");

scheduleTextArea.setLineWrap(true);
scheduleTextArea.setRows(4);
scheduleTextArea.setWrapStyleWord(true);
scheduleTextArea.setEditable(false);

//Set button action
button1.addActionListener(this);
button1.setActionCommand("Calculate");

//Create the loan amount field
loanAmountFormat = NumberFormat.getInstance();
loanAmountFormat.setMaximumFractionDigits(2);
loanAmountField = new JFormattedTextField(loanAmountFormat);
loanAmountField.setValue(new Double(loanAmount));
loanAmountField.setText("");
loanAmountField.setColumns(10);
loanAmountField.addKeyListener(myKeyAdapter);
termFormat = NumberFormat.getInstance();
termFormat.setMaximumFractionDigits(0);
termField = new JFormattedTextField(termFormat);
termField.addKeyListener(myKeyAdapter);
aprFormat = NumberFormat.getInstance();
aprFormat.setMaximumFractionDigits(2);
aprField = new JFormattedTextField(aprFormat);
aprField.addKeyListener(myKeyAdapter);

//Create the Loan combo box
//Create the Monthly Payment read only field
loanList = new JComboBox(loan);
loanList.addActionListener(myLoanListListener);
loanList.setSelectedIndex(3);
monthlyPaymentFormat = NumberFormat.getCurrencyInstance();
monthlyPaymentField = new JFormattedTextField(monthlyPaymentFormat);
Double payment = 0.0;
monthlyPaymentField.setValue(new Double(payment ));
monthlyPaymentField.setColumns(10);
monthlyPaymentField.setEditable(false);

//Add all the panels
myPanel.add(loanAmountLabel);
myPanel.add(loanAmountField);
myPanel.add(termLabel);
myPanel.add(termField);
myPanel.add(loanLabel);
myPanel.add(loanList);
myPanel.add(aprLabel);
myPanel.add(aprField);
myPanel.add(monthlyPaymentLabel);
myPanel.add(monthlyPaymentField);
myMenu.add(calcMenuItem);
myMenu.add(clearMenuItem);
myMenu.add(exitMenuItem);
myMenuBar.add(myMenu);
innerPanel.add(myMenuBar, BorderLayout.EAST);
innerPanel.add(myPanel, BorderLayout.SOUTH);
buttonPanel.add(button1, BorderLayout.EAST);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(40,20,0,20));
buttonPanel.add(schedulePayLabel, BorderLayout.SOUTH);
scheduleScrollPane1.setBorder(BorderFactory.createEmptyBorder(0,20,0,80));
outerPanel.add(innerPanel);
outerPanel.add(buttonPanel);
outerPanel.add(scheduleScrollPane1);
outerPanel.add(myChart);
add(outerPanel);
setBorder(BorderFactory.createEmptyBorder(20,20,20,20));//create border
}

//Set up our window and show it
private static void createAndShowGUI() {

//Set up the window
JFrame frame = new JFrame("Mortgage Calculator 2");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
RobertWK5 newContentPane = new RobertWK5();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
}

//Main function
public static void main(String[] args) {
//Create and show GUI
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}


public void actionPerformed(ActionEvent arg0) {
String cmd = arg0.getActionCommand();
if (cmd == "Exit")
{
System.exit(0);
}
if (cmd == "Clear")
{
loanList.setSelectedIndex(3);
loanAmountField.setValue(0);
loanAmountField.setText("");
termField.setValue(0);
termField.setText("");
aprField.setValue(0);
aprField.setText("");
scheduleTextArea.setText("");
monthlyPaymentField.setValue(0);
loanAmount = 0.0;
graphFrame.setVisible(false);
graphFrame.removeAll();
}
if (cmd == "Calculate")
{
// On click display the payment amount.
try {
loanAmountField.commitEdit();
} catch (ParseException e) {
popupError("The loan amount is blank");
return;
}
if (loanIndex == 3) //Select from dropdown menu
{
try {
aprField.commitEdit();
} catch (ParseException e) {
popupError("The apr is blank.");
return;
}
try {
termField.commitEdit();
} catch (ParseException e) {
popupError("The term is blank.");
return;
}
}
loanAmount = ((Number)loanAmountField.getValue()).doubleValue();
if (loanAmount > 0)
{
if (loanIndex < 3)
{
Double monthlyPayment = computePayment(loanAmount, apr[loanIndex], term[loanIndex]);
monthlyPaymentField.setValue(new Double(monthlyPayment));
graphAngle = displayAmortizationTable(term[loanIndex], apr[loanIndex], loanAmount, monthlyPayment);
}
else
{
double aprCustom = ((Number)aprField.getValue()).doubleValue();
int termCustom = ((Number)termField.getValue()).intValue();
if (termCustom == 0)
{
popupError("The term is zero.");
return;
}
Double monthlyPayment = computePayment(loanAmount, aprCustom, termCustom);
monthlyPaymentField.setValue(new Double(monthlyPayment));
graphAngle = displayAmortizationTable(termCustom, aprCustom, loanAmount, monthlyPayment);
}

}
else
{
popupError("The loan amount is zero.");
}

}
}
private Double computePayment(double loanAmount, double apr, int term) {

// method to calculate monthly payment
double monthlyPayment;
double interestRate = apr/100/12;
if (term > 0)
{
if (apr > 0)
{
monthlyPayment = (loanAmount * interestRate) /
(1 - Math.pow((1 + interestRate), -(term * 12)));
}
else
{
monthlyPayment = loanAmount / (term * 12);
}
}
else
{

monthlyPayment = loanAmount;
}
return monthlyPayment;
}


private void popupError(String error)
{
JOptionPane.showOptionDialog(null, error,
"Warning", JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE, null, null, null);
}
private int displayAmortizationTable(int term, double apr, double principalBalance, double monthlyPayment){
double totalInterest = 0;
double totalBalance = principalBalance;
if (principalBalance > 0)
{
String textOut = "";
double interestRate = apr/100/12;
for(int period = 1; period <= (term * 12); period++) {
double interestPayment;

//Amortization table
interestPayment = interestRate * principalBalance;
totalInterest = totalInterest + interestPayment;
principalBalance = principalBalance - (monthlyPayment - interestPayment);
if (Math.round(principalBalance * 100) > 0)
{
textOut = textOut + period
+ "\t" + NumberFormat.getCurrencyInstance().format(principalBalance)
+ "\t" + NumberFormat.getCurrencyInstance().format(interestPayment) + "\n";
} else {
textOut = textOut + "Final"
+ "\t" + NumberFormat.getCurrencyInstance().format(principalBalance)
+ "\t" + NumberFormat.getCurrencyInstance().format(interestPayment);
}
}
scheduleTextArea.setText(textOut);
}
double angle = ((totalInterest / (totalBalance + totalInterest)) * 360);
return (int) Math.round(angle);
}
}

 

This is what i have s far,what do you think?

Customer replied 1348 days and 15 hours ago.

RG 421 - Service Request SR-mf-003 - Change Request 7. This is what i'm working on, so i need a help.

 

thanks.

Picture
Expert:  Rafael Martins replied 1348 days and 15 hours ago.

Well, I don't know the requirements of the assignment, could you post them here?

If you have a DOC or PDF file describing what is needed, please upload it to www.wikisend.com and then paste here the download link.

Thanks.

Customer replied 1348 days and 15 hours ago.

Java Program (without a graphical user interface) that will display the mortgage payment,
loan balance and interest paid over the course of the loan with a screen pause.
This change request will be to show each monthly payment and interest over the life of the mortgage.
The second change request shows the monthly payment for 3 different loans over different lengths of time
and with different interest rates.
This third change request is to print out all three mortgages over the life of the loan.
This fourth change request takes the user to the web to show an applet for the basic calulation and show
the monthly payment for what ever the user enters in the fields on the web browser.
The fifth change request asks that the user be able to select a loan product from a list ( menu ) and to
show the entire mortgage. Arrays need to be used to handle this request.
The sixth change requests asks that it allow the user to select which way they want to calculate a mortgage:
by input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage
payment or by input of the amount of a mortgage and then select from a menu of mortgage loans.
The seventh change request is including a graph to the mix.
*/

Mortgage Calculator - PRG 421 - Service Request SR-mf-003 - Change Request 7

Picture
Expert:  Rafael Martins replied 1348 days and 15 hours ago.

Ok, I got it. Actually, I have recognized this assignment now, and I know that it requires a lot of work. I am sorry, but I think your question is underpriced.

I am opting out this question to leave it open.

Good luck.

Customer replied 1348 days and 14 hours ago.

so what is the right price for it? can somone tell me how much it will cost me?

Customer replied 1348 days and 14 hours ago.

Hey Rafael, if i can get it by noon tomorrow, name your price.

Picture
Expert:  Rafael Martins replied 1348 days and 14 hours ago.

Thanks Benny, but cannot have it done by noon tomorrow and also I'am not allowed to talk about the price here at JustAnswer. I am sorry once again.

If you wait a while, another expert should be able help you out.

Best wishes,
Rafael Martins.

Picture
Expert:  Rafael Martins replied 1348 days and 14 hours ago.

Thanks Benny, but I cannot have it done by noon tomorrow, and also I am not allowed to talk about the price here at JustAnswer. I am sorry once again.

If you wait a while, another expert should be able help you out.

Best wishes,
Rafael Martins.

Customer replied 1348 days and 14 hours ago.

Thanks

 
Tweet

9 Programmers are Online Right Now

Ask Your Question Now
Programming Questions Date Submitted
is there a python programming person available 3/28/2013
Write a menu-driven program that allows users do two options: Option 3/27/2013
1. Which one of the following control structures provides for 3/27/2013
JavaScript: Multiple Choice Questionnaire 3/25/2013
RA-211 3/24/2013
How do you create a searchable public Google drive folder in 3/24/2013
RA-211 3/24/2013
I am an entrepreneur with no current coding skills, but an 3/23/2013
I have base code in VBA that opens all excel files from a folder 3/23/2013
Program in C++ 3/23/2013
RSS
Next 10 >
Ask A Programmer
Type Your Programming Question Here...
characters left:

Top Programming Experts

See More Programmers

In The News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More
close
Find Expert answers related to your question.
Sign up using email
We will never post anything without your permission.
Already have an account? Sign in

Ask a Programmer

Get a Professional Answer. 100% Satisfaction Guaranteed.
197 Programmers are Online Now
Type Your Programming Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us
© 2003-2013 JustAnswer LLC