Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Cathy Dinh
Java GUI code
1 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


Write a GUI program to compute the amount of a certificate of deposit on maturity. The sample data follows:

Amount deposited: 80000.00 Years: 15 Interest rate: 7.75 Total Amount: Hint** to solve this problem, computer 80000.00 (1+7.75 /100)^15


Advertisement
View Answers

December 13, 2010 at 3:22 PM


Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class TotalAmount extends JFrame
{
        TotalAmount(){
        JLabel lab1=new JLabel("Amount");
        final JTextField text1=new JTextField(20);

        JLabel lab2=new JLabel("Rate of Interest");
        final JTextField text2= new JTextField(20);

        JLabel lab3=new JLabel("Time");
        final JTextField text3=new JTextField(20);

        JButton b=new JButton("Get");
        b.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
            double p=Double.parseDouble(text1.getText());
            double r=Double.parseDouble(text2.getText());
            double t=Double.parseDouble(text3.getText());

            double v1=r/100;
            double v2=1+v1;
            double v3=Math.pow(v2,t);
            double amount=p*v3;
            JOptionPane.showMessageDialog(null, "Total Amount is: "+amount);

            }
        });
           setLayout(null);
           lab1.setBounds(10,10,100,20);
           text1.setBounds(150,10,200,20);
           lab2.setBounds(10,40,100,20);
           text2.setBounds(150,40,200,20);
           lab3.setBounds(10,70,100,20);
           text3.setBounds(150,70,200,20);
           b.setBounds(150,110,70,20);
           add(lab1);
           add(text1);
           add(lab2);
           add(text2);
           add(lab3);
           add(text3);
           add(b);
           setVisible(true);
           setSize(400,200);
        }
    public static void main(String[] args) 
    {
    new TotalAmount();
        }
}

Thanks



Related Tutorials/Questions & Answers:
Java GUI code
Java GUI code  Write a GUI program to compute the amount of a certificate of deposit on maturity. The sample data follows: Amount deposited..., computer 80000.00 (1+7.75 /100)^15   Hi Friend, Try the following code
Rental Code GUI - Java Beginners
Rental Code GUI  dear sir... i would like to ask some code of java GUI form that ask the user will choose the menu to input Disk #: type: title: record company: price: director: no. of copies
Advertisements
Java GUI code- creating a circle
Java GUI code- creating a circle  My assignment is to write a program..., and area. I did my code but I can't seem to figure out the mathematical code...; //GUI components JLabel lClx, lCly, lCircumrx, lCircumry, lRadius
Convert this code to GUI - Java Beginners
Convert this code to GUI  I have written this.i need to convert the following code to GUI:- import java.awt.*; import java.applet.*; import...); } }  hi friend, We have convert your code into GUI
How to convert this Java code into GUI?
How to convert this Java code into GUI?   import java.util.Scanner; public class StudentMarks { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks
Catching Exceptions in GUI Code - Java Tutorials
.style1 { text-align: center; } Catching uncaught exception in GUI In this section, we will discuss how to catch uncaught exceptions in GUI. Lets see the given below code to identify the uncaught exception : import
Convert the code to GUI
GUI code  GUI code
Convert the code to GUI
Java Code to GUI   can any one convert My code to GUI code
Convert the code to GUI
GUI Example  GUI Example code to learn
Convert the code to GUI
Java GUI Class Example  Java GUI Class Example
Convert the code to GUI
GUI Java JSP application  GUI Java JSP application
Convert the code to GUI
Java and GUI application Example  Java and GUI application Example
Convert the code to GUI
How to Convert the code to GUI   How to convert a code into GUI
Convert the code to GUI
How to create GUI application in Java   How to create GUI application in Java
Convert the code to GUI
Convert the code   How to convert a code to GUI look alike
Convert the code to GUI
Is it possible to convert a code into GUI  Is it possible to convert a code into GUI
java gui
java gui   friends... good day.. i have doubt in java gui. ? i created 1 java gui application. That has two text fields jtext1,jtext2. case: user... must go to the next text field(jtext2). How can i arrange this. which code can i
Convert the code to GUI
GUI Application example  GUI Application example
Convert the code to GUI
GUI Application Development   GUI Application Development
Convert the code to GUI
Write a GUI Application  best way to write a GUI based application
Java GUI
Java GUI  1) Using Java GUI, create a rectangular box that changes color each time a user click a change color button. 2) Modify Question 1 to include a new button named insert image, that allow user to insert a bitmap image
Convert the code to GUI ??
Convert the code to GUI ??  hi >> can anyone help me to conver this code to GUI ?? /** * @(#)RegistorClass.java * *. * @author...("*** Invalid operation code ***"); halt= true; // break
Convert the code to GUI
Convert the code to GUI   can any one convert My code to GUI code...: System.out.println("*** Invalid operation code... ??? System.out.println(); } } `print("code sample");` thanks
Convert the code to GUI
GUI example for beginners  GUI example for beginners  sory ,, I will posted my code again import java.util.Scanner; public class...; default: System.out.println("*** Invalid operation code
HOW TO CONVERT THIS CODE INTO GUI
HOW TO CONVERT THIS CODE INTO GUI   System.out.println("\n\t UGANDA CHRISTIAN UNIVERSITY\n"); System.out.println("\n\tFACULTY OF SCIENCE AND TECHNOLOGY\n"); System.out.println("\n BACHELOR OF SCIENCE IN COMPUTER
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
covert this code to GUI
covert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return
 

 

 

DMCA.com