Language: Java Rewrite the ADA source code in Java. Within the Java version of the code, 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. ADA source code: 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;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Language: Java

Rewrite the ADA source code in Java.

Within the Java version of the code, 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.


ADA source code:

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;

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY