[Show all top banners]
Back to: Kurakani General Refresh page to view new replies
 java help
[VIEWED 5334 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 90 days
Recommended Popular Threads Controvertial Threads
शीर्षक जे पनि हुन सक्छ।
NRN card pros and cons?
What are your first memories of when Nepal Television Began?
TPS Re-registration case still pending ..
Basnet or Basnyat ??
nrn citizenship
Sajha has turned into MAGATs nest
Nas and The Bokas: Coming to a Night Club near you
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
3 most corrupt politicians in the world
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
if you are in USA illegally and ask for asylum it is legal
Travelling to Nepal - TPS AP- PASSPORT
निगुरो थाहा छ ??
ढ्याउ गर्दा दसैँको खसी गनाउच
Poonam pandey - death or suicide?
Doctors dying suddenly or unexpectedly since the rollout of COVID-19 vaccines
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
lost $3500 on penny stocks !!!
TPS Work Permit/How long your took?
Nas and The Bokas: Coming to a Night Club near you
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