Question

I'm currently working on Jframe and running into some issues getting it to run properly. I...

I'm currently working on Jframe and running into some issues getting it to run properly. I am required to have these 4 elements Principal amount(Text field and label) Interest rate (Text field and label) Submit button Monthly payment If anyone could give me a had it would be appreciated.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the program in java

import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
class InterestCalculator extends JFrame implements ActionListener {
  

// create a frame
static JFrame f;
  
// create a textfield
static JTextField txtPrincipal, txtRate;
static JLabel lblPrincipal, lblRate, lblInterest;
  
// main function
public static void main(String args[])
{
// create a frame
f = new JFrame("Interest Calculator");
InterestCalculator c = new InterestCalculator();
// create a textfield
txtPrincipal = new JTextField(16);
txtRate = new JTextField(16);
       // create label field
       lblPrincipal=new JLabel("Principal Amount:");
       lblRate=new JLabel("Rate of Interest");
       lblInterest = new JLabel(" ");
// create number buttons and some operators
JButton butSubmit;
// create number buttons
butSubmit = new JButton("Calculate");
// create a panel
JPanel p = new JPanel();
// add action listeners
butSubmit.addActionListener(c);
  
// add elements to panel
p.add(lblPrincipal);
p.add(txtPrincipal);
p.add(lblRate);
p.add(txtRate);
p.add(lblInterest);
p.add(butSubmit);
  
// add panel to frame
f.add(p);
  
f.setSize(200, 220);
f.show();   
}
public void actionPerformed(ActionEvent e)
{
String s = e.getActionCommand();
if (s.equals("Calculate")) {
System.out.println("hurray");
lblInterest.setText("show calculated interest here");
}
}

}

Sample output:

Interest Calculator Principal Amount: 100 Rate of Interest show calculated interest here Calculate

Add a comment
Know the answer?
Add Answer to:
I'm currently working on Jframe and running into some issues getting it to run properly. I...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi! I need some help with this topic. Currently I am working on it with another...

    Hi! I need some help with this topic. Currently I am working on it with another similar and relevant topic but the time is very short and my paper is 12 pages long. So please can someone give a boost? this is the question: summarize or give a synopsis on Principal values of equilibrium's effects on the balance of matter and energy.

  • I am working on integrating a database to an Android application for a course. Currently, I have all the database code done, but getting all of the EditText fields to enter data into the database has...

    I am working on integrating a database to an Android application for a course. Currently, I have all the database code done, but getting all of the EditText fields to enter data into the database has me stuck. Assignment objectives here, so we can be on the same page: Create a second page with a data entry form and the following fields: recipename, category, ingredients, and instructions. Make the Category field a dropdown box that contains the recipe categories listed...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • I'm pretty sure about all input areas needing a value in them and I corrected some...

    I'm pretty sure about all input areas needing a value in them and I corrected some of the mistakes from the previous tutor's answer but I'm still getting some of the numbers incorrect. Can someone help me with the remaining incorrect inputs? Lou Lewis, the president of Lewisville Company, has asked you to give him an analysis of the best use of a warehouse the company owns. a. Lewisville Company is currently leasing the warehouse to another company for $6,800...

  • need this in #c . You will now add server side validation code to the frmPersonnel...

    need this in #c . You will now add server side validation code to the frmPersonnel page. Currently, when the Submit button is pressed, the frmPersonnelVerified page is displayed. This is because the frmPersonnelVerified page is set as the Submit button's PostBackUrl property. Instead of having the page go directly to the frmPersonnelVerified page when the Submit button is pressed, we want to do some server side validation. If any of the validation rules fail, we will redisplay the frmPersonnel...

  • Posting this again because day limit has run out. Again I really need help with this....

    Posting this again because day limit has run out. Again I really need help with this. This is for my Advanced Java Programming class. The book we use is Murach's Java Servlet's and JSP 3rd Edition. The program used is NetBeans IDE 8.2. I need help modifying or adding some code. I will post the code I was told to open that needs to be modified below. Exercise 9-3     Use JSTL to add a table to the Future Value application. In...

  • I'm not getting out put what should I do I have 3 text files which is...

    I'm not getting out put what should I do I have 3 text files which is in same folder with main program. I have attached program with it too. please help me with this. ------------------------------------------------------------------------------------ This program will read a group of positive numbers from three files ( not all necessarily the same size), and then calculate the average and median values for each file. Each file should have at least 10 scores. The program will then print all the...

  • Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the...

    Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the following case study : You have recently been hired as an HR Consultant in the new HR Department of Outrage Video Games. Outrage is a five year old, upstart company, run by two very bright young men - Will Bates – President, and his best friend Steve Cobbs, Vice President. This is a very exciting change for you because Outrage, which literally started in...

  • Evelyn’s Sweets

    Evelyn has been working as an Administrative Assistant for the past four years. As a mother of an energetic five-year old, the part-time job has worked well for her. With Mick, her son, heading off to school next month (September 2022), Evelyn is considering new career options, perhaps starting in January. Her employer has been getting busier and has offered Evelyn full-time employment if she ever desires it. The full-time offer would transition Evelyn from an hourly rate of $21...

  • Hello, I'm having trouble with the trial balance. Can someone please help me with it. I...

    Hello, I'm having trouble with the trial balance. Can someone please help me with it. I think something is wrong with the adjusted trial balance. khampton ACCOUNTING SERVICE INC Dear Newbie, Welcome to Hampton! My name is Julio Antoni, your supervisor. We believe the best way for you to get familiar with what you are going to be doing here is to throw you right in, so we are asking you to start working on the books for us right...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT