[Show all top banners]

bange
Replies to this thread:

What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 java help
[VIEWED 11014 TIMES]
SAVE! for ease of future access.
Posted on 09-12-11 10:50 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Does it have to be swing? Are you trying to make something like this?
http://www.amortizationtable.org/amortization-calculator/

 
Posted on 09-12-11 10:51 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Does it have to be swing? Are you trying to make something like this?
http://www.amortizationtable.org/amortization-calculator/

 
Posted on 09-12-11 11:26 AM     [Snapshot: 70]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Then do this on command line,
pseudo code
Display headers
for i=0 to 3
get inputs
calculate outputs
display as row
end

 
Posted on 09-12-11 11:37 AM     [Snapshot: 94]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

public class creditcardassignment

{



  public static void main(String[] args) {

    int run;
    int i=0;

    while(i < 4 ){

    String Run_Question = JOptionPane.showInputDialog(null, "How many times do you like to run the program? (Up to four runs only!)", JOptionPane.QUESTION_MESSAGE);

    run = Integer.parse(Run_Question);

    if(run > 4 && run <1) {

      JOptionPane.showMessageDialog(null, "The number is invalid,please try again!", "Error",

      JOptionPane.INFORMATION_MESSAGE);
     
      exit(0);
    }

    }
   
    List<Info> infoList = new Arraylist<Info>();
   
    for(int i=0; i<run; i++) {
//get input from users and calculate output
      //enter or calculate intialprinciple
      //enter or calculateintialpayment
      //enter or calculateAPR
      //enter or calculate noofpayments
      //enter or calculate totalinterestpaid
     
      //create info object
      //add allthe above principle, payment, apr, no of payments, interest paid to info object
      Info i = new Info();
      i.add(intialprinciple) and so on
     
     
      ArrayList.add(i);
    }
    //iterate and display content from List in tabular format

  }


}

public class Info {
    double initialPrinciple;
    double initialPayment;
    double APR;
    double noOfPayments;
    double totalInterestPaid;
   
    //add getter setter

}

 
Posted on 09-12-11 11:40 AM     [Snapshot: 100]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

/* Som ework for you  ... use you formula to calulate..just used semo formula
    use do while loop to take to input for 4 times only
*/


import javax.swing.JOptionPane;

import java.text.DecimalFormat;
import javax.swing.JFrame;
import javax.swing.JTextArea;


public class Table extends JFrame{
 private static JTextArea output;
 public Table(){
 int lp, ap,mp;
   int count=0;
    String loanPrincipal = JOptionPane.showInputDialog(null, "Enter Initial Loan Princial", JOptionPane.QUESTION_MESSAGE);
    String annualPercentage = JOptionPane.showInputDialog(null, "Enter Annual Percentage", JOptionPane.QUESTION_MESSAGE);
    String monthlyPayment = JOptionPane.showInputDialog(null, "Enter MonthlyPayment", JOptionPane.QUESTION_MESSAGE);
    if(loanPrincipal!=null && annualPercentage!=null && monthlyPayment!=null){
     lp = Integer.parseInt(loanPrincipal);
     ap= Integer.parseInt(loanPrincipal);
     mp=Integer.parseInt(loanPrincipal);
     output = new JTextArea(10,15);
     int results = lp * ap; // use your own formula to calculate : this is just a demo
     output.append("Loan Principal"+" "+"Annual %"+" "+"Monthly Payment"+" "+"Results");
     output.append("\n");
     output.append(lp +"\t"+ ap +"\t"+mp+ "\t"+ results);
     this.getContentPane().add(output,"Center");
     this.setSize(400,600);
     this.setLocation(100,200);
     this.show();
     count++;
    }else{
     JOptionPane.showMessageDialog(null, "The number is invalid,please try again!", "Error",
     JOptionPane.INFORMATION_MESSAGE);
     count++;
   }
 
 }
 public static void main(String[]args){
  Table t = new Table();
 }
}

 
Posted on 09-12-11 11:42 AM     [Snapshot: 112]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

O0ops !! that count++ in code was to take count input...forgot to remove everything....
right now it doesnt make any sense to have count ++
post if you need any further help..

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 365 days
Recommended Popular Threads Controvertial Threads
ANA and AJAY KUMAR DEV. RAPISTS CONVENTION
NRN card pros and cons?
TPS To F-1 COS
Nepal TPS has been Extended !!!
Got my F1 reinstatement approved within 3 months(was out of F1 for almost 2 years)
Has anyone here successfully reinstated to F-1 status after a year-long gap following a drop from F-1?
US citizen Petitioning my wife who was out of status when she was in H1B. What to do ?
Democrat wants to run election like in India. Chaos and Confusing to voters.
Please ask KRISTI NOEM in her facebook and other social media to renew TPS
Supreme Court allows Trump to end TPS for Venezuelans
Nepal TPS decision
TPS to F1 Status.
legal Query for married nepali girl now have taken US citizenship
ICE kidnapping people off the streets over op eds
ए १ पनि पुगेनछ ?
Trump’s “Big Beautiful Bill” is straight-up xenophobic class warfare. Let’s call it what it is.
2020 : Why No Trump !
Business Ideas in Nepal?
A legit Non-Profit organization "United For TPS Nepal "
Leave messages on US congressman's facebook to support TPS
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters