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.

 * Created on Aug 1, 2009, 12:59:41 PM

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

    /** Creates new form car */
    public car() {

    /** 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.
    // <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();


        jButton1.setForeground(new java.awt.Color(204, 0, 51));

        jButton2.setForeground(new java.awt.Color(255, 153, 0));

        jButton3.setForeground(new java.awt.Color(51, 204, 0));

        jButton4.setForeground(new java.awt.Color(153, 0, 153));
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent 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());
            .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)
                .addGap(19, 19, 19))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(296, Short.MAX_VALUE)
                    .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)
                .addGap(27, 27, 27))
                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(254, Short.MAX_VALUE))
                .addGap(46, 46, 46)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(26, 26, 26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE)
                        .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)

    }// </editor-fold>//GEN-END:initComponents

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

    public car(JButton jButton1) {
        this.jButton1 = jButton1;

    * @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:

//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

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

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, learning, and sharing knowledge.