Welcome to Dream.In.Code
Become an Expert!

Join 136,939 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,864 people online right now. Registration is fast and FREE... Join Now!




How could i convert this code to pascal and c?

 
Reply to this topicStart new topic

How could i convert this code to pascal and c?, This is about savings quickie program...

zkim
12 Mar, 2008 - 10:24 PM
Post #1

New D.I.C Head
*

Joined: 11 Mar, 2008
Posts: 6


My Contributions
java
class saving{


public static void main(String arg[]) throws IOException {
BufferedReader stdin =
new BufferedReader ( new InputStreamReader (System.in));
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;
String answer;
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;
char reply;
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 :=> $ ");
get_P_Balance= stdin.readLine();
n_P_Balance = Double.parseDouble(get_P_Balance);
System.out.print("ENTER INTEREST RATE PERCENT :=> ");
get_P_Interest= stdin.readLine();
n_P_Interest = Double.parseDouble(get_P_Interest);
System.out.print("ENTER NUMBER OF YEARS :=> ");
get_No_Years= stdin.readLine();
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 => ");
answer = stdin.readLine();
reply = answer.charAt(0);
if (reply =='n' || reply=='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);
}
else if (reply =='Y' || reply=='y')


{
// 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 :=> $ ");
get_P_Balance2= stdin.readLine();
n_P_Balance2 = Double.parseDouble(get_P_Balance2);
System.out.print("ENTER INTEREST RATE PERCENT :=> ");
get_P_Interest2= stdin.readLine();
n_P_Interest2 = Double.parseDouble(get_P_Interest2);
System.out.print("ENTER NUMBER OF YEARS :=> ");
get_No_Years2= stdin.readLine();
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) + ".");
}
}
} while (reply== 'Y' || reply == 'y');
}
} // End of Code


Mod edit: added code tags: code.gif
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: How Could I Convert This Code To Pascal And C?
15 Mar, 2008 - 06:24 PM
Post #2

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,461



Thanked: 10 times
Dream Kudos: 325
My Contributions
Do you know Pascal and C?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:52PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month