Java Programming class Average using String and double data type - IT 111

Today, we study the Java Programming class Average. Class here means title of a program you are going to make. And the Average is now our title and take note, if what is the class, it will be your file name when you save your program to prevent errors. As I notice Java Programming is very sensitive in term of keys. So meaning if it is capital letters, see to it that you input in capital, same process also in small letters.

Here, I String and double for the data type. The code below will show you the Average of a student from Pre-lim, Mid-term, Pre-final and Final.

Source Code:
import java.util.*;
public class Average
{
 public static void main(String[]args)
 {

  String Sname;
  double prelim, midterm, prefinal, finals;

Scanner in= new Scanner(System.in);
System.out.println("Enter student");
Sname = in.next();
System.out.println("Enter Prelim Grade");
prelim = in.nextDouble();
System.out.println("Enter Midterm Grade");
midterm = in.nextDouble();
System.out.println("Enter Prefinals Grade");
prefinal = in.nextDouble();
System.out.println("Enter Finals Grade");
finals = in.nextDouble();

System.out.println("Student Name:"+Sname+"\n"+"Average is:"+(prelim + midterm + prefinal + finals)/4);
 }
}

What would you notice the code above? there is something different?

If you ask me, yes, there is something different, if you notice the double data type above which defining the variables, it is in small letter. But in the body of the program which you can input the numbers, you can see that first letter of double become capital. So where is the keys sensitive here?

May be it is in the software (textpad) structure of coding. See another code and formula on how to solve average. 
Related Posts Plugin for WordPress, Blogger...