Write the grade distribution from ADA program to JAVA. in JAVA version, change the second half of
Question:
Write the grade distribution from ADA program to JAVA.
in JAVA version, change the second half of the first loop so that all assignments to the counting Array "Freq()" are updated in the Exception portion of the code. There should be no valid updates to "Freq()" anywhere else in the loop.
Deliverables
1) A copy of your new code
2) A test run of your code to show that it is working.
the following is the ADA code to be rewritten in JAVA :
with Ada.Text_IO , Ada.Integer_Text_IO ; use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Grade_Distribution is Freq: array (1..10) of Integer := (others => 0); New_Grade : Natural; Index, Limit_1, Limit_2 : Integer; begin Grade_Loop: loop begin Get(New_Grade); exception when Constraint_Error => exit Grade_Loop; end; Index := New_Grade/10 + 1; begin Freq(Index) := Freq(Index) +1 ; exception when Constraint_Error => if New_Grade = 100 then Freq(10) := Freq(10) + 1; else Put("Error -- new grade: "); Put(New_Grade); Put(" is out of range"); New_Line; end if; end; end loop Grade_Loop; Put("Limits Frequency"); New_Line; New_Line; for Index in 0..8 loop Limit_1 := 10 * Index; Limit_2 := Limit_1 + 9; if Index = 9 then Limit_2 := 100; end if; Put(Limit_1); Put(Limit_2); Put(Freq(Index +1)); New_Line; end loop; end Grade_Distribution;
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley