Advertisement
Guest User

finalescore

a guest
May 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. Scanner s= new Scanner(System.in);
  7. double x, n, y,grade; //variables
  8. System.out.print("please enter test score, number of assignment and average of assignment");//telling user what data to insert
  9. x=s.nextDouble();//receiving data from user
  10. n=s.nextDouble();//receiving data from user
  11. y=s.nextDouble();//receiving data from user
  12. if(n<=4) { //first check number of assignment
  13. grade=x;
  14. }
  15. else if(n<=7) { // second check
  16. if (x < 60) {
  17. grade = (0.9 * x) + (0.1 * y);
  18. } else {
  19. grade = (0.8 * x) + (0.2 * y);
  20. }
  21. }
  22. else //when first and second gave false
  23. {
  24. if (x<60)
  25. {
  26. grade = (0.6 * x) + (0.4 * y);
  27. }
  28. else
  29. {
  30. grade = (0.7 * x) + (0.3 * y);
  31. }
  32. }
  33. System.out.println("your final grade is: "+grade);//output final score;
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement