Advertisement
arabdy

perro quiz

Sep 16th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package quiz;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class quiz {
  6.     public static void main(String[] args) {
  7.         Scanner sc = new Scanner(System.in);
  8.         double resultado;
  9.         System.out.println("Nota Quiz Uno");
  10.         double q1 = sc.nextDouble();
  11.        
  12.         System.out.println("NoTa Quiz Dos");
  13.         double q2 = sc.nextDouble();
  14.        
  15.  
  16.         resultado = calcularNota(q1, q2);
  17.         System.out.println(resultado);
  18.  
  19.         sc.close();
  20.     }
  21.  
  22.     static double calcularNota(double q1, double q2) {
  23.         double resultado;
  24.         if (q1 > q2) {
  25.             return resultado = (q1 * 0.7) + (q2 * 0.3)/2;
  26.         } else if (q2 > q1) {
  27.             return resultado = (q2 * 0.7) + (q1 * 0.3)/2;
  28.         } else {
  29.             return resultado = (q1 * 0.7) + (q2 * 0.3)/2;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement