Thursday 8 January 2009 photo 1/1
![]() ![]() ![]() |
import javax.swing.*;
public class MinMath {
public static double upphöjtTill(double x, int n) {
double res = 1;
int i = 1;
if (n >= 0)
for ( ; i <= n; i++)
res = res * x;
else
for ( ; i <= -n; i++)
res = res / x;
return res;
}
public static double räntaPåRänta
(double b, double r, int n) {
return b * upphöjtTill(1+0.01*r, n);
}
public static double beloppVidUttag(double b, double r, int n, double ut) {
if (ut > b*0.01*r) {
JOptionPane.showMessageDialog(null, "För stort uttag");
return 0;
}
else {
for (int år=1; år <= n; år++)
b = b + b*0.01*r - ut;
return b;
}
}
public static double nfak(int n) {
double r=1;
for (int i=2; i <=n; i++)
r = r*i;
return r;
}
public static int siffSum(int tal) {
int sum = 0;
while(tal > 0) {
sum = sum + tal % 10;
tal = tal / 10;
}
return sum;
}
public static int antalSiffror(int tal) {
int i = 0;
while (tal > 0) {
tal = tal / 10;
i++;
}
return i;
}
}
Java?:S:S:S:S:S::S:S:S:S::S:S::S:S::S:S::SS
public class MinMath {
public static double upphöjtTill(double x, int n) {
double res = 1;
int i = 1;
if (n >= 0)
for ( ; i <= n; i++)
res = res * x;
else
for ( ; i <= -n; i++)
res = res / x;
return res;
}
public static double räntaPåRänta
(double b, double r, int n) {
return b * upphöjtTill(1+0.01*r, n);
}
public static double beloppVidUttag(double b, double r, int n, double ut) {
if (ut > b*0.01*r) {
JOptionPane.showMessageDialog(null, "För stort uttag");
return 0;
}
else {
for (int år=1; år <= n; år++)
b = b + b*0.01*r - ut;
return b;
}
}
public static double nfak(int n) {
double r=1;
for (int i=2; i <=n; i++)
r = r*i;
return r;
}
public static int siffSum(int tal) {
int sum = 0;
while(tal > 0) {
sum = sum + tal % 10;
tal = tal / 10;
}
return sum;
}
public static int antalSiffror(int tal) {
int i = 0;
while (tal > 0) {
tal = tal / 10;
i++;
}
return i;
}
}
Comment the photo




9 comments on this photo
Directlink:
http://dayviews.com/onkelborris/316925238/