Java Programming and Technical Programming Arrays

You have a block of platinum that can be exchanged in your bank either for cash or for smaller blocks of platinum. If you exchange a block of m grams, you get three blocks of weight m/2, m/3 and m/4 grams each. You don't get any fractional part, as the division process rounds down the value. If you exchange the block of platinum for cash, you get m units of currency. You can do any number of exchanges for smaller blocks or currency.
Given the value of a block in grams as input, write a program that would print the largest possible currency value that you can receive as the output. Assume that the maximum value of a block that can be given as an input is 1,000,000,000 grams and the minimum value is 2 grams.

Read Solution (Total 1)

Java Other Question

875432103654 import java.io.BufferedReader;
//import java.io.FileNotFoundException;
import java.io.FileReader;


public class Calculatefrompara {

private static BufferedReader bin;
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub


FileReader fin=new FileReader("test.txt");
bin = new BufferedReader(fin);

int Alphabets=0,digits=0,splchars=0,lowercase=0,uppercase=0;
String line=bin.readLine();

int i;
//char c1;
while(line!=null)
{
for( i=0;i=97 && j<=122)|| (j>=65 && j<=90))
{
Alphabets++;
}
else
if(j>=97 && j<=122)
{
lowercase++;
}

else
if(j>=65 && j<=90)
{
uppercase++;
}
else
if(j>=48 && j<=57)
{
digits++;
}
else
{
splchars++;
}


}
line=bin.readLine();


}

System.out.println("alphabets:"+Alphabets);
System.out.println("lowercase:"+lowercase);
System.out.println("uppercase:"+uppercase);
System.out.println("digits:"+digits);
System.out.println("splchrs:"+splchars);

}

}