SHARE
TWEET

Untitled

a guest Mar 26th, 2020 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. public class MethodsAndArray {
  3.  
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner in = new Scanner (System.in);
  7.         int s=0;
  8.        
  9.         String v = " ";
  10.         String ans = "TFFTFFTTTTFFTFTFTFTT" ;
  11.         char arr[] = ans.toCharArray();
  12.         System.out.print(arr);
  13.         System.out.println();
  14.         String a = "TFFTFFTTTTFFTFTFT TT";
  15.         String c[] = {"ABC54301","ABC59310","ABC39583","ABC38493","ABC10394",
  16.                       "ABC10005","ABC10007","ABC38558","ABC10011","ABC10512",
  17.                       "ABC10013","ABC10014","ABC10415","ABC10016","ABC10017"};
  18.         char b[] = a.toCharArray();
  19.        
  20.         for (int i=0 ; i<arr.length ; i++)
  21.         {
  22.            
  23.            
  24.             if (b[i] == ' ')
  25.                 s+= 0;
  26.             else
  27.                 if (b[i] == arr[i])
  28.                     s+=2;
  29.                 else
  30.                     s++;
  31.         }
  32.        
  33.         double ave = s*100/40;
  34.         System.out.println("Student answer: " + a + " Score:" + s + " ave:" + ave +"% " + v );
  35.         if (ave >= 0 && ave <=59.99)
  36.             v = "F";
  37.         else if (ave >= 60 && ave <=69.99)
  38.             v = "D";
  39.         else if (ave >= 70 && ave <=89.99)
  40.             v = "C";
  41.         else if (ave >= 80 && ave <=89.99)
  42.             v = "B";
  43.         else
  44.             v = "A";
  45.        
  46.     }
  47.    
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top