How could i convert this code to pascal and c?

windows

Guest
<script language="javascript" src="http://www.dreamincode.net/syntax/shBrushjava.js"></script>
<div class='codetop'>java</div><div class='codemain' style="padding: 0px !important;"><pre name="code" class="java">class saving{<br /><br /><br /> public static void main(String arg[]) throws IOException {<br /> BufferedReader stdin =<br /> new BufferedReader ( new InputStreamReader (System.in));<br /> DecimalFormat twoDigitsPastPoint = new DecimalFormat("0.00");<br /> // Variables Declation<br /> String get_P_Balance, get_P_Interest, get_No_Years;<br /> String get_P_Balance2, get_P_Interest2, get_No_Years2;<br /> String answer;<br /> double n_Number_Years=0;<br /> double n_P_Balance=0.00, n_P_Interest=0.00;<br /> double n_Final_Solve=0.00;<br /> int a=0;<br /> char reply;<br /> System.out.print("\n\t =========================================");<br /> System.out.print("\n\t ==Savings Quickie Version 1.0===");<br /> System.out.print("\n\t =========================================");<br /> System.out.print("\n\n");<br /> System.out.print("ENTER PRESENT SAVINGS BALANCE :=> $ ");<br /> get_P_Balance= stdin.readLine();<br /> n_P_Balance = Double.parseDouble(get_P_Balance);<br /> System.out.print("ENTER INTEREST RATE PERCENT :=> ");<br /> get_P_Interest= stdin.readLine();<br /> n_P_Interest = Double.parseDouble(get_P_Interest);<br /> System.out.print("ENTER NUMBER OF YEARS :=> ");<br /> get_No_Years= stdin.readLine();<br /> n_Number_Years = Double.parseDouble(get_No_Years);<br /> System.out.print("\n");<br /> System.out.print(" === COMPUTED RESULTS === ");<br /> System.out.print("\n\n");<br /><br /><br /> for (a=1; a<= n_Number_Years; a++) {<br /> n_Final_Solve =n_Final_Solve + n_P_Interest * (n_Final_Solve + n_P_Balance) /100;<br /> System.out.println("Year No. "+ a + " => $ " + twoDigitsPastPoint.format(n_Final_Solve + n_P_Balance) + ".");<br /> }<br /><br /><br /> do {<br /> System.out.print("\n\n");<br /> System.out.print("DO YOU WANT TO continue Y/N => ");<br /> answer = stdin.readLine();<br /> reply = answer.charAt(0);<br /> if (reply =='n' || reply=='N')<br /><br /><br /> {<br /> System.out.print("\n\n");<br /> System.out.print("\t\t===================================================== " );<br /> System.out.println("\n\t\t\t THANK YOU for USING this PROGRAM" ); <br /> System.out.println("\t\t Program Coding & Design By: Jake Rodriguez Pomperada " );<br /> System.out.print("\t\t===================================================== " );<br /> System.out.print("\n\n");<br /> System.exit(0);<br /> }<br /> else if (reply =='Y' || reply=='y')<br /><br /><br /> {<br /> // Second Part of the Code for Continuat<br /> // ion of the execution of the code<br /> // to prevent errorneous computation if <br /> // you call again the main code of<br /> // the program you must assign a new var<br /> // iable to avoid such problem.<br /> double n_P_Balance2=0.00, n_P_Interest2=0.00;<br /> double n_Final_Solve2=0.00;<br /> double n_Number_Years2=0;<br /> int a2=0;<br /> System.out.print("\n\n");<br /> System.out.print("\n\t =========================================");<br /> System.out.print("\n\t ==Savings Quikie Version 1.0===");<br /> System.out.print("\n\t =========================================");<br /> System.out.print("\n\n");<br /> System.out.print("ENTER PRESENT SAVINGS BALANCE :=> $ ");<br /> get_P_Balance2= stdin.readLine();<br /> n_P_Balance2 = Double.parseDouble(get_P_Balance2);<br /> System.out.print("ENTER INTEREST RATE PERCENT :=> ");<br /> get_P_Interest2= stdin.readLine();<br /> n_P_Interest2 = Double.parseDouble(get_P_Interest2);<br /> System.out.print("ENTER NUMBER OF YEARS :=> ");<br /> get_No_Years2= stdin.readLine();<br /> n_Number_Years2 = Double.parseDouble(get_No_Years2);<br /> System.out.print("\n");<br /> System.out.print(" === COMPUTED RESULTS === ");<br /> System.out.print("\n\n");<br /><br /><br /> for (a2=1; a2<= n_Number_Years2; a2++) {<br /> n_Final_Solve2 =n_Final_Solve2 + n_P_Interest2 * (n_Final_Solve2 + n_P_Balance2) /100;<br /> System.out.println("Year No. "+ a2 + " => $ " + twoDigitsPastPoint.format(n_Final_Solve2 + n_P_Balance2) + ".");<br /> }<br /> }<br /> } while (reply== 'Y' || reply == 'y');<br /> }<br />} // End of Code</pre></div><br /><br />Mod edit: added code tags: <img src="http://static.dreamincode.net/forums/style_emoticons/default/code.gif" style="vertical-align:middle" emoid=":code:" border="0" alt="code.gif" />
</div>
 
Back
Top