Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner s= new Scanner(System.in);
- double x, n, y,grade; //variables
- System.out.print("please enter test score, number of assignment and average of assignment");//telling user what data to insert
- x=s.nextDouble();//receiving data from user
- n=s.nextDouble();//receiving data from user
- y=s.nextDouble();//receiving data from user
- if(n<=4) { //first check number of assignment
- grade=x;
- }
- else if(n<=7) { // second check
- if (x < 60) {
- grade = (0.9 * x) + (0.1 * y);
- } else {
- grade = (0.8 * x) + (0.2 * y);
- }
- }
- else //when first and second gave false
- {
- if (x<60)
- {
- grade = (0.6 * x) + (0.4 * y);
- }
- else
- {
- grade = (0.7 * x) + (0.3 * y);
- }
- }
- System.out.println("your final grade is: "+grade);//output final score;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement