Beginners Programs :

Java Program : Calculate Batting Average Example | Programs

Java Program to calculate the batting average. The following program is written in five different ways by using standard values, user-defined method, scanner class, through creating a separate class. Do check it out.

Methods we used in this Cricket Batting Program:

  • Using standard Method
  • Using Scanner Class
  • Using Command Line Arguments
  • User Define Method
  • Separate Class

By Using Standard Values

  • There you go, by using the basic standard input values we wrote this program
output:

2. By Using Scanner Class

  • By using scanner class: There you method: 2 just by using scanner class. Do check it out.
output:
 

3. Using Command Line Arguments 

By using command line arguments: If you have no idea about what are command line arguments do check out our guide: Here.

output:

4.By Using User Define Method

There you go another program using a user-defined method.

output:

5. Separate Class

Java program for calculating batting average through creating a separate class(AvgCalculation ) and taking inputs through scanner class.

output:
Learn More: