Prob6ch9 - } System.out.println(); System.out.println();

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; import java.lang.*; import java.io.*; import java.text.*; import java.math.*; import java.text.DecimalFormat; // Jeremy Debruce // 4/9//2009 //Chapter 9 Prob. G / public class Prob6ch9 { static DecimalFormat td = new DecimalFormat ("0.00"); static int i,j,c; static double Sum; static double[]num=new double[5]; static String TANS; static String StR,LG; static String[][] St1; public static void main(String[] args) { String[]ID={"ABC54301","BBC12345","CDD55544","AAB22233"}; String[]ANS={"T","F","F","T","F","F","T","T","T","T","F","F","T","F","T","F","T","F ","T","T"}; String[][]St1={{"T","F","T","F","T","F","T","T"," ","T","F","T","F","T","F","F","T","T","F","T"}, {"T","F","F","T","F","F"," "," ","T","T","F","F","T","F","T","F","T","F","T","F"}, {"T","F","F"," "," ","F","T","T","T","T","F","F","F","F","F","F","T","F","T","T"}, {"T","F","F","T","F","F","T","T","T","T","F","F","T","F","T","F","T","F","T","F"}}; System.out.print("The Answer Sheet is => "); for (j=0;j<20;j++) { System.out.print(" " +ANS[j]);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } System.out.println(); System.out.println(); System.out.println(&quot;*************************************************************** &quot;); System.out.println(&quot; ID. Test GRADES AVG LETTER*&quot;); System.out.println(&quot;*************************************************************** &quot;); &quot; for (i=0;i&lt;4;i++) f for (j=0;j&lt;20;j++) { TANS = ANS[j]; StR = St1[i][j]; if(StR.compareTo(TANS)==0) num[i]=num[i]+2; else if(StR.compareTo(TANS)!=0&amp;&amp;StR.compareTo(&quot; &quot;)!=0) num[i]=num[i]-1; } for (i=0;i&lt;4;i++) { System.out.print(ID[i]+&quot; &quot;); for (j=0;j&lt;20;j++) { System.out.print(St1[i][j]+&quot; &quot;); } Sum = num[i]/40*100; System.out.print(td.format(Sum)); if (Sum&gt;=90) { LG = &quot;A&quot;; System.out.print(&quot; &quot;+LG); } else if (Sum&gt;=80&amp;&amp;Sum&lt;=89) { LG = &quot;B&quot;; System.out.print(&quot; &quot;+LG); } else if (Sum&gt;=70) { LG = &quot;C&quot;; System.out.print(&quot; &quot;+LG); } else if (Sum&gt;=60) { LG = &quot;D&quot;; System.out.print(&quot; &quot;+LG); } else { LG = &quot;F&quot;; System.out.print(&quot; &quot;+LG); } System.out.println(); } } }...
View Full Document

Page1 / 2

Prob6ch9 - } System.out.println(); System.out.println();

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online