A simple program that I wrote using Java programming language to compute the average score given by the user.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
Program Listing
/**
* @author Jake Rodriguez Pomperada, MAED-IT, MIT
* jakerpomperada@gmail.com
* www.jakerpomperada.com
* Bacolod City, Negros Occidental
* October 20, 2020 Monday
*/
import java.util.Scanner;
public class Average_Score {
public static void main(String[] args) {
// TODO Auto-generated method stub
int score1, score2, score3, score4, score5 ;
double average;
char repeat;
String input;
Scanner keyboard = new Scanner(System.in);
do
{
System.out.println("\n");
System.out.print("\t\tAverage Score in Java");
System.out.println("\n");
System.out.print("\tEnter Score No. 1 : ");
score1 = keyboard.nextInt();
System.out.print("\tEnter Score No. 2 : ");
score2 = keyboard.nextInt();
System.out.print("\tEnter Score No. 3 : ");
score3 = keyboard.nextInt();
System.out.print("\tEnter Score No. 4 : ");
score4 = keyboard.nextInt();
System.out.print("\tEnter Score No. 5 : ");
score5 = keyboard.nextInt();
keyboard.nextLine();
average = (score1 + score2 + score3 + score4 + score5) / 5.0;
System.out.println();
System.out.println("\tThe average score is " + average);
System.out.println();
System.out.print("\tContinue Y for yes or N for no: ");
input = keyboard.nextLine();
repeat = input.charAt(0);
} while (repeat == 'Y' || repeat == 'y');
System.out.print("\n\n");
System.out.println("\tEnd of Program");
System.out.println("\n\n");
}
}
No comments:
Post a Comment