submit itec320-02 assist2.adbScale 4.0 A Excellent 2.0 C Average 0.0 F Failure Grades 3 A 3 F 3 C Targets 2.0 3.0 Grades 4 C 3 C 3 F Targets 3.0 Scale 0.0 N No credit 10.0 O Outstanding 5.0 P Passable 7.0 R Rather good Grades 3 N 3 P Targets Grades 3 N 3 R Targets 6.0 EndThe output produced is as follows:
Scale
4.0 A Excellent
2.0 C Average
0.0 F Failure
Current points: 18
Current hours: 9
Current GPA: 2.00
Target GPA: 2.00
Current GPA >= Target
Target GPA: 3.00
Points deficit: 9.00
Higher grade: A Excellent
Hours needed: 9
New surplus: 9.00
Resulting GPA: 3.00
Current points: 14
Current hours: 10
Current GPA: 1.40
Target GPA: 3.00
Points deficit: 16.00
Higher grade: A Excellent
Hours needed: 16
New surplus: 16.00
Resulting GPA: 3.00
Scale
10.0 O Outstanding
7.0 R Rather good
5.0 P Passable
0.0 N No credit
Current points: 15
Current hours: 6
Current GPA: 2.50
Current points: 21
Current hours: 6
Current GPA: 3.50
Target GPA: 6.0
Points deficit: 15
Higher grade: O Outstanding
Hours needed: 4
New surplus: 16.00
Resulting GPA: 6.10
Higher grade: R Rather good
Hours needed: 15
New surplus: 15.00
Resulting GPA: 6.00
End of data
Input specifications:
The input will contain the following sequence one or more times, followed by the keyword "End" on a single line.
You might want to look into the packages Ada.Strings.Fixed and Ada.Characters.Handling. Some of their routines might be useful for this assignment.
Your program should read from standard input and write to standard output,
which is the default for get and put.
Do NOT use a file that is named in your program for input.
For your own benefit, you should test your program using a set of test cases that are stored in a file. To cause standard input to read from a file you should use redirection, as shown in this example:
assist2 < datafile.txtIf you are using Adagide, you can cause standard input to come from a file by using the "Run/Run Options" dialog. Select your input data file and check the "Redirect input" box. Please remember that if you put your data in a file, then end_of_file is automatically detected after the last character in the file has been reached - you do NOT put a control-D or a control-Z into the file!
In coming up with your Ada solution to the following problem, please follow my style guide. In particular, please note the use of consistent indentation and descriptive constant and variable names. Please remember that the first thing in any program file should be a comment that gives a brief overview of what the file contains (and should do). Also remember to keep your lines less than 80 characters long. Not only does this mean that printouts won't run off the side of the page, but it also makes your programs look neater on an 80 column wide xterm window (a popular size). If you are unsure of an element of programming style, please ask, as I would be more than happy to show you what I want.
Use the submit command to turn your
program in for grading. You may submit
as many times as you like, but only the last submission
is kept. In particular, be aware that since only the last submission is
kept, if the last one is late, then your assignment is late and will thus
receive a late penalty. Also remember that you must be on
rucs rucs2 for submit to work. To submit your work for grading
do the following:
submit itec320-02 assist2.adb