# Arithmetic Operations

To calculate the grade from the midterm and final exams we must divide (midterm+final) by 2. If we use midterm+final/2, it will find the midterm plus half of the final.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| //your name
//find average of midterm and final
package grades;
import java.util.*;
public class ExamAverage {
public static void main(String[] args) {
Scanner keyboard=new Scanner(System.in); //do just onceint quantity,dozen;
double midtermExam, finalExam, average;
System.out.print("What is the midterm grade?");
midtermExam=keyboard.nextDouble();
System.out.print("What is the final grade?");
finalExam=keyboard.nextDouble();
average=(midtermExam+finalExam)/2;
System.out.println("Your average is "+average);
}//main
}//package |

CODEWhat is the midterm grade?80
What is the final grade?90
Your average is 85

Remember, you should try doing each of these programs on your own. Get it to work, break it, modify it, then try to write it on your own!