class Rectangle
{
int length, width;
Rectangle(int x, int y)
{
length = x;
width = y;
}
int rectArea()
{
return (length * width);
}
}
class RectangleArea
{
public static void main(String args[])
{
Rectangle rect1 = new Rectangle(15,10);
int area1 = rect1.rectArea();
System.out.println("Rectangle = " + area1);
}
}
Area and Perimeter of Rectangle,Java Rectangle Example,Calculating,program to find area and rectangle,
Students marks analyzing system ||Download Student Marks Details Code In Java Source Codes||
import javax.swing.JOptionPane;
class GreatPoint
{
public static void main( String args[])
{
float bang,eng,mat,per;
String num1 ; String num2 ; String num3;
//Output for input number,persubject
num1=JOptionPane.showInputDialog("Enter the first number");
num2=JOptionPane.showInputDialog("Enter the second number");
num3=JOptionPane.showInputDialog("Enter the third number");
bang=Integer.parseInt(num1);
eng=Integer.parseInt(num2);
mat=Integer.parseInt(num3);
per=(bang+eng+mat)/3;
if(per>=80)
JOptionPane.showMessageDialog(null,"A+");
else if((per>=75)&&(per>65))
JOptionPane.showMessageDialog(null,"A");
else if((per>=65)&&(per>50))
JOptionPane.showMessageDialog(null,"A-");
else
JOptionPane.showMessageDialog(null,"fail");
}
}
Sum of Fibonacci Series
public class FibonacciA
{
public static void main(String[] args)
{
int sum=0;
// Initialize some variables
int current, prev = 1, prevprev = 0;
// Loop exactly 10 times
for(int i = 0; i < 10; i++)
{
// Next number is sum of previous two
current = prev + prevprev;
System.out.println(current + " ");// Print it out
sum+=current;
// First previous becomes 2nd previous
prevprev = prev;
// And current number becomes previous
prev = current;
}
// Terminate the line, and flush output
System.out.println();
System.out.print("Result= " + sum);
}
}
Labels:
E balagurusamy,
Example-Fibonacci Numbers,
Fibonacci Numbers,
java books,
java code,
java programming code,
PROGRAMMING WITH JAVA,
Sum of Fibonacci Series
Posted by
Unknown
1 comments
Programming Code Sum of Fiboneci Number
{
public static void main(String args[])
{
int sum=0;
System.out.println("The numbers and the sum are given below");
for(int i=1;i<=10;i++)
{
System.out.println(i);
sum+=i;
}
System.out.print("\n");
System.out.print("Result ; " + sum);
}
}
Labels:
Example-Fibonacci Numbers,
Fibonacci Sequence,
Fibonacci.java,
Java - Source Code,
Programming Code Sum of Fiboneci Number
Posted by
Unknown
0
comments