In this assignment, you have to write and execute ADA program. This ADA program will save records of students
of Computer Science. This program will contain 3 parts as described below:
Data of each student will be StudentID, Marks, and Status (Pass/Fail). Use appropriate data type for these
Record should be used to save student data and you are required to initialize records of 2 students only by
assigning proper values. While initializing, StudentID should be your VU Roll Number in both records. For
Marks, and Status field, use arbitrary values.
After completing Part 1, define your own type by the name of FinalScore. Its range should be from 50 to 100.
After that, create a variable Marks1 of FinalScore data type.
After completing Part 2, initialize Marks1 with 50 and then begin a loop. During each iteration of loop, increment
the value of Marks1 by 10. Following output should be shown in each iteration:
If Marks1 is greater than or equal to 50 and less than or equal to 65, output will be:
Marks range is 50-65, PASS, Needs Improvement
If Marks1 is greater than 65 and less than or equal to 75, output will be:
Marks range is 65-75, PASS, Average
If Marks1 is greater than 75 and less than equal to 90, output will be:
Marks range is 75-85, PASS, Very Good
After completing the program, run the code in GNATMAKE 8.1.0 [see Note below], take screenshot, and paste it
in your solution file.
Your solution file must be a single Word file (.doc or .docx) containing the following:
1) Complete code written in Word [you can use Consolas font for enhancing readability of the code]
2) Output screenshot (take multiple screenshots by scrolling appropriate area if your code and output window
do not fit in one screen)
How to compile and run ADA code:
You can use GNATMAKE 8.1.0 to compile and run ADA code. For this purpose, visit this link:
In Code window, write your ADA program.
After writing the code, press Execute button. The Result window will show the output of the code.
Take screenshot(s) and paste it in your solution file. Both Code window and Result window must be
visible in the screenshot. Take multiple screenshots, if necessary.
Code: Select all
Solution: with Ada.Text_IO; use Ada.Test_IO; with Ada.Integer_TEXT_IO; use Ada.Integer_TEXT_IO; procedure assignment is type Student is record student_ID: String(1..11); Marks: Integer := 0; Status: Boolean := False; end record; stu1, stu2: Student; type FinalScore is range 50..100; Marks1: FinalScore; begin stu1.Student_ID := "bc123456789"; stu1.Marks := 75; stu1.Status := True; stu2.Student_ID := "bc123456789"; stu1.Marks := 80; stu1.Status := False; Marks1 := 50; input: LOOP if Marks1 >= 50 and Marks1 <= 65 then Put_Line("Marks range is 50-65, PASS, Needs Improvement"); end if; if Marks1 > 65 and Marks1 <= 75 then Put_Line("Marks range is 65-75, PASS, Needs AVERAGE"); end if; if Marks1 > 75 and Marks1 <= 90 then Put_Line("Marks range is 75-85, PASS, VERY GOOD"); end if; Marks1 := Marks1 + 10; exit when Marks1 = 100; END LOOP input; end assignment;