VB icon

Average Grade Using One Dimensional Array in Java

Email
Submitted on: 8/29/2015 1:41:47 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 6005
author picture
 
     In this example I wrote a program that will compute the average grade of the student on his or her several subjects using one dimensional array in Java the code is very simple to understand and use. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360. Thank you very much and Happy Programming.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Average Grade Using One Dimensional Array in Java
// Description:In this example I wrote a program that will compute the average grade of the student on his or her several subjects using one dimensional array in Java the code is very simple to understand and use.
If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
// By: Jake R. Pomperada
//**************************************

/*
average_array.java
Programmer By: Mr. Jake R. Pomperada, MAED-IT
Date : July 23, 2015
Tools: NetBeans 8.0.2, Java SE 8.0
Problem No. 2:
 
Write a program that will ask the user to give eight grades for
eight subjects and then our program will find average grade of 
the student from the eight subjects.
*/
 
import java.util.Scanner;
class grade_array {
public static void main(String[] args) {
 
 Scanner input = new Scanner(System.in);
 char ch;
 String[] subjects = new String[]
 {"Computer", "Math", "English","Physical Education",
 "History","Science","Music and Arts","Filipino"};
 
 do { 
 int [] values; 
 values = new int[8]; 
 int x=0,average_grade=0,total_sum=0;
 System.out.print("Average Grade Solver");
 System.out.println();
 for (int a=0; a<8; a++)
 {
 x=1;
 x+=a;
 System.out.print("Enter your subject grade on " + subjects[a] + " : ");
 values[a] = input.nextInt();
 total_sum+=values[a];
 average_grade = total_sum/8;
 }
 System.out.println(); 
 System.out.println();
 System.out.print("Your average grade is 8 subject is " + average_grade + ".");
 System.out.println();
 System.out.print("\nDo you want to continue (Type y or n) : ");
 ch = input.next().charAt(0);
 } while (ch == 'Y'|| ch == 'y'); 
 System.out.println();
 System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
 System.out.println("\n\n");
 }
} // End of Code


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.