User blog: 102322020 陳明慈

Picture of 102322020 陳明慈
by 102322020 陳明慈 - Monday, April 20, 2015, 6:24 PM
Anyone in the world

import java.util.Scanner;

public class practice0420
{

public static void main(String[] args){

double numbera,numberb,numberc,min,mean;

java.util.Scanner input=new Scanner(System.in);

System.out.println("input number a:");
numbera=input.nextDouble();

System.out.println("input number b:");
numberb=input.nextDouble();

System.out.println("input number c:");
numberc=input.nextDouble();

min=methodA(numbera,numberb,numberc);
System.out.println("the min is : "+min);


System.out.println("the mean is : "+mean);

}


public static double methodA(double numbera,double numberb,double numberc){

double i;

if(numbera>numberb)i=numberb;
else i=numbera;

if(numberc>i)i=i;
else i=numberc;


return i;
}

public static double methodB(double numbera,double numberb,double numberc){

double i;

i=(numbera+numberb+numberc)/3.0;


return i;
}

}

[ Modified: Monday, April 20, 2015, 6:24 PM ]
 

  
RSS