Posted by: serial September 12, 2011
 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
}
{
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
}
