1. Title
Read the values of two floating-point numbers A and B, corresponding to the results of two students.
Please calculate the average score of the students, where the weight of A's grade is 3.5, and the weight of B's grade is 7.5.
The value range of the grades is between 0 and 10, and one decimal place is reserved.
Input format The
input occupies two lines, each line contains a floating point number, the first line represents A, and the second line represents B.
Output format The
output format is "MEDIA = X", where X is the average score, and the result is to five decimal places.
Data range
0≤A, B≤10.0
Input example:
5.0
7.1
Sample output:
MEDIA = 6.43182
2. Code
import java.util.Scanner;
import java.text.DecimalFormat;
public class Main
{
public static void main(String[] args)
{
Scanner cin=new Scanner(System.in);
double a=cin.nextDouble();
double b=cin.nextDouble();
double x=a*3.5/11+b*7.5/11;
DecimalFormat df=new DecimalFormat("0.00000"); //保留五位小数
System.out.println("MEDIA = "+df.format(x));
}
}