# How could i convert this code to pascal and c?

Page 1 of 1

## 1 Replies - 1224 Views - Last Post: 15 March 2008 - 07:24 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=46069&amp;s=fbc0223f2295afa233ba97fe6cbfffc5&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 zkim

Reputation: 0
• Posts: 6
• Joined: 11-March 08

# How could i convert this code to pascal and c?

Posted 12 March 2008 - 11:24 PM

class saving{

public static void main(String arg[]) throws IOException {
DecimalFormat twoDigitsPastPoint = new DecimalFormat("0.00");
// Variables Declation
String get_P_Balance, get_P_Interest, get_No_Years;
String get_P_Balance2, get_P_Interest2, get_No_Years2;
double n_Number_Years=0;
double n_P_Balance=0.00, n_P_Interest=0.00;
double n_Final_Solve=0.00;
int a=0;
System.out.print("\n\t =========================================");
System.out.print("\n\t ==Savings Quickie Version 1.0===");
System.out.print("\n\t =========================================");
System.out.print("\n\n");
System.out.print("ENTER PRESENT SAVINGS BALANCE :=> \$ ");
n_P_Balance = Double.parseDouble(get_P_Balance);
System.out.print("ENTER INTEREST RATE PERCENT :=> ");
n_P_Interest = Double.parseDouble(get_P_Interest);
System.out.print("ENTER NUMBER OF YEARS :=> ");
n_Number_Years = Double.parseDouble(get_No_Years);
System.out.print("\n");
System.out.print(" === COMPUTED RESULTS === ");
System.out.print("\n\n");

for (a=1; a<= n_Number_Years; a++) {
n_Final_Solve =n_Final_Solve + n_P_Interest * (n_Final_Solve + n_P_Balance) /100;
System.out.println("Year No. "+ a + " => \$ " + twoDigitsPastPoint.format(n_Final_Solve + n_P_Balance) + ".");
}

do {
System.out.print("\n\n");
System.out.print("DO YOU WANT TO continue Y/N => ");

{
System.out.print("\n\n");
System.out.print("\t\t===================================================== " );
System.out.println("\n\t\t\t THANK YOU for USING this PROGRAM" );
System.out.println("\t\t Program Coding & Design By: Jake Rodriguez Pomperada " );
System.out.print("\t\t===================================================== " );
System.out.print("\n\n");
System.exit(0);
}

{
// Second Part of the Code for Continuat
//     ion of the execution of the code
// to prevent errorneous computation if
//     you call again the main code of
// the program you must assign a new var
//     iable to avoid such problem.
double n_P_Balance2=0.00, n_P_Interest2=0.00;
double n_Final_Solve2=0.00;
double n_Number_Years2=0;
int a2=0;
System.out.print("\n\n");
System.out.print("\n\t =========================================");
System.out.print("\n\t ==Savings Quikie Version 1.0===");
System.out.print("\n\t =========================================");
System.out.print("\n\n");
System.out.print("ENTER PRESENT SAVINGS BALANCE :=> \$ ");
n_P_Balance2 = Double.parseDouble(get_P_Balance2);
System.out.print("ENTER INTEREST RATE PERCENT :=> ");
n_P_Interest2 = Double.parseDouble(get_P_Interest2);
System.out.print("ENTER NUMBER OF YEARS :=> ");
n_Number_Years2 = Double.parseDouble(get_No_Years2);
System.out.print("\n");
System.out.print(" === COMPUTED RESULTS === ");
System.out.print("\n\n");

for (a2=1; a2<= n_Number_Years2; a2++) {
n_Final_Solve2 =n_Final_Solve2 + n_P_Interest2 * (n_Final_Solve2 + n_P_Balance2) /100;
System.out.println("Year No. "+ a2 + " => \$ " + twoDigitsPastPoint.format(n_Final_Solve2 + n_P_Balance2) + ".");
}
}
}
} // End of Code

Is This A Good Question/Topic? 0

## Replies To: How could i convert this code to pascal and c?

### #2 Tom9729

• Segmentation fault

Reputation: 181
• Posts: 2,642
• Joined: 30-December 07

## Re: How could i convert this code to pascal and c?

Posted 15 March 2008 - 07:24 PM

Do you know Pascal and C?