


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is solution to assignment for Aeronautical Engineering and Computer Programming course. It was submitted to Prof. Chitraksh Gavde at Biju Patnaik University of Technology, Rourkela. It includes: Algorithm, Distance, Listing, Error, Procedure, Ada, Natural, Float, Compute, Begin, Bug, Fix
Typology: Exercises
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Compiling: c:/docume~2/joeb/desktop/adatex~1/fk3-w95/distance_with_errors.adb (source file time stamp: 1998-09-13 23:11:36)
invalid parameter list in call (use -gnatf for details)
expected type "Standard.Float" found type "Standard.Integer"
-- display results
Ada.Text_IO.Put (Item => "You will travel about ");
Ada.Float_Text_IO.Put (Item => HowFar); |
invalid parameter list in call (use -gnatf for details) possible missing instantiation of Text_IO.Integer_IO
33 lines: 5 errors
GNAT 3.13p (20000509) Copyright 1992-2000 Free Software Foundation, Inc.
Compiling: c:/docume~2/joeb/desktop/adatex~1/fk3-w95/distance_with_errors.adb (source file time stamp: 2003-09-10 10:41:38)
. WITH Ada.Text_IO; . with Ada.Float_Text_Io; . with Ada.Integer_Text_IO; . PROCEDURE Distance_with_Errors IS . -------------------------------------------------------------- . --| Finds distance, given travel time and average speed . --| Author: Michael eldman, The George Washington University . --| Last Modified: June 1998 . -------------------------------------------------------------- . HowLong : Natural; . HowFast : Float; . HowFar : Natural; . . BEGIN -- Distance_with_Errors . . -- prompt user for hours and average speed . Ada.Text_IO.Put . (Item => "How long will you be driving (integer)? "); . Ada.Integer_Text_IO.Get (Item => HowLong); . Ada.Text_IO.Put . (Item => "At what speed (miles per hour, integer)?"); . Ada.Float_Text_IO.Get (Item => HowFast); . . -- compute distance driven . HowFar:= HowLong * Integer(HowFast); . . -- display results . Ada.Text_IO.Put (Item => "You will travel about "); . Ada.Integer_Text_IO.Put (Item => HowFar); . Ada.Text_IO.Put (Item => " miles"); . Ada.Text_IO.New_Line; . . END Distance_with_Errors; .
34 lines: No errors
GNAT 3.13p (20000509) Copyright 1992-2000 Free Software Foundation, Inc.
Compiling: c:/docume~2/joeb/desktop/16070/concep~1/convert_weight.adb (source file time stamp: 2003- 09-10 18:46:40)
. ---------------------------------------------------- . -- Program : To Convert the user weight in kilograms . -- into pounds. . -- Programmer : Joe B . -- Date Last Modified : 09/10/ . ------------------------------------------------------ . . . with Ada.Text_Io; . with Ada.Float_Text_Io; . . procedure Convert_Weight is . . Weight_In_Kg, Weight_In_Lb : Float; . -- set the conversion factor to convert between kilograms and pounds . Conversion_Factor : constant Float := 0.453592; . . begin -- Convert_Weight . -- get user input . Ada.Text_Io.Put(Item => "Please Enter Your Weight in Kilograms "); . Ada.Float_Text_Io.Get(Item => Weight_In_Kg); . Ada.Text_Io.Skip_Line; . . Ada.Text_Io.New_Line; . -- perform the conversion . Weight_in_lb := Weight_in_Kg / Conversion_Factor; . . -- display the computed result to the user . Ada.Float_Text_Io.Put(Item => Weight_In_Kg, Fore => 4, Aft => 3, Exp => 0); . Ada.Text_Io.Put(Item => " kg = "); . . Ada.Float_Text_Io.Put(Item => Weight_In_lb, Fore => 4, Aft => 3, Exp => 0); . Ada.Text_Io.Put(Item => " lb"); . . end Convert_Weight;
35 lines: No errors