Develop a car loan payment calculator. Design a GUI, using NetBeans GUI Builder, to enter price of car, down payment, interest rate, and length of loan in years. Your bank only offers 3 interest rates 5%, 10%, and 12% based on credit rating. Use grouped radio buttons to select between great credit (5% interest), average credit (10% interest), and poor credit ( 12% interest). Monthly payment should be calculated by the application and displayed in the GUI. Use appropriate GUI components to allow a user to enter the necessary information to calculate the loan payments and to display the calculated loan payment. It is not required to have your loan payment rounded to only two decimal places.

Recommended Answers

All 4 Replies

Here's the code you posted. Does it compile? What's the question? You apparently have created the GUI, but I don't see the calculation code.

As a design note, I don't know if I would have "car" extend JFrame. Consider naming your JFrame "InterestCalculationGUI" or something. When I see "Car", I think "year", "make", "model", "price", stuff like that, not Swing GUI components. Just my personal preference.

import javax.swing.JButton;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * car.java
 *
 * Created on Aug 1, 2009, 12:59:41 PM
 */

/**
 *
 * @author smith
 */
public class car extends javax.swing.JFrame {

    /** Creates new form car */
    public car() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jTextField4 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setForeground(new java.awt.Color(204, 0, 51));
        jButton1.setText("Good");
        buttonGroup1.add(jButton1);

        jButton2.setForeground(new java.awt.Color(255, 153, 0));
        jButton2.setText("Average");
        buttonGroup1.add(jButton2);

        jButton3.setForeground(new java.awt.Color(51, 204, 0));
        jButton3.setText("Poor");
        buttonGroup1.add(jButton3);

        jButton4.setForeground(new java.awt.Color(153, 0, 153));
        jButton4.setText("Calculate");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jTextField1.setForeground(new java.awt.Color(0, 0, 204));
        jTextField1.setText("Price of Car");

        jTextField2.setForeground(new java.awt.Color(0, 153, 153));
        jTextField2.setText("Down Payment");

        jTextField3.setForeground(new java.awt.Color(102, 0, 102));
        jTextField3.setText("Loans in Years");

        jTextField4.setForeground(new java.awt.Color(204, 204, 0));
        jTextField4.setText("Monthly loan payment result");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 244, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(19, 19, 19))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(296, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton4)
                            .addComponent(jButton2)))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 221, Short.MAX_VALUE)
                        .addComponent(jButton3)))
                .addGap(27, 27, 27))
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(254, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addGap(26, 26, 26)
                        .addComponent(jButton3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE)
                        .addComponent(jButton4))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47)
                        .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(37, 37, 37)
                        .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
       System.Calculate();
    }

    public car(JButton jButton1) {
        this.jButton1 = jButton1;
    }//GEN-LAST:event_jButton4ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new car().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    // End of variables declaration//GEN-END:variables

}

I think the thread maker is wanting someone else to finish the project, which clearly won't happen here.

Its not too hard to finish though, just make sure you get the values from the textfields, set up a few if else statements for the jbuttons and then make a class to do the calculations.

Get text entered from textfield:

jTextField1.getText()
//use to get the needed values, also this will give you a string so you'll want to change it to int

Determine which radio button is selected:

if (jRadioButton1.isSelected()) {
            //set interest rate to 5%
        } else if (jRadioButton2.isSelected()) {
            //set interest rate to 10%
        } else if (jRadioButton3.isSelected()) {
            i//set interest rate to 12%
        }

Come up with some code and I'm sure there will be more help offered

can u help me with my website please because i do not have any idea how to do or how to start it.
if someone knows how to do it please explain for me from the first stel until the end please.
thanks lot
Alex

can u help me with my website please because i do not have any idea how to do or how to start it.
if someone knows how to do it please explain for me from the first step until the end please.
thanks lot
Alex

If you want someone to explain it to you from start to end, then buy a book and do some studying!
We can not explain it to you because we don't have the time nor daniweb has the space for us to post everything there is especially when those can be found in many books. Do some studying, show some effort and we will answer specific questions after you start a NEW thread.

Start by reading about html, then move to jsp and servlets and if you want database look about database connectivity and java.

But you need to be very good with core java first before you proceed otherwise you would be wasting your time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.