Assignment No. 02 |
Total Marks: 20
Due Date: 28/05/2014 |
|
Instructions: Please read the following instructions carefully before submitting assignment:
Objectives:
To understand and familiarize with ADA Language.
|
||
For any query about the assignment, contact at cs508@vu.edu.pk or through MDB. |
||
Assignment Questions |
||
Question Marks 10
To find the area of a sphere we use following formula Write a complete program in Ada to solve this formula. Note that each mathematical operator (such as multiplication and division) should be solved in a separate subprogram.
In the main program you will use 7 as the value of r. Your program will display the final result and your VU student id.
Hint : You need to solve equation (4 / 3 ) *( 3.14 * r * r *r)
Question Marks 10
You will go to page http://www.compileonline.com/compile_ada_online.php
Paste you code written in the Question 1 in right hand pan and press Compile & Execute button, then you will take screen shot of the output and paste in your solution file. As shown below
|
||
BEST OF LUCK
|
Tags:
Muhammad Junaid Arshad, What is the procedures and how to use them? Please explain and give us code with thanks....time is very short
ap ne function kaisae banaye hain ?
procedure se ya phir package se ??
with Ada.Text_IO;with Ada.Integer_Text_IO; with Ada.Float_Text_IO;
use Ada.Text_IO;use Ada.Integer_Text_IO;use Ada.Float_Text_IO;
procedure find is
var1 : Float := 4.0;
var2 : Float := 3.0;
var3 : Float := 7.0;
var4 : Float := 3.14;
var5 : Float;
var6 : Float;
var7 : Float;
function number_division(var1, var2 : Float) return FLOAT;
function number_division(var1, var2 : Float) return FLOAT is
begin
var5:= var1/ var2;
return var5;
end number_division;
function number_multiplication (var3, var4, var5 : FLOAT) return FLOAT;
function number_multiplication (var3, var4, var5 : FLOAT) return FLOAT is
begin
var6 := var3 * var3 * var3;
var6 := var6 * var4 * var5;
return var6;
end number_multiplication;
begin
put("ID: BC100200944");
var5 := number_division(var1, var2);
var6 := number_multiplication (var3, var4, var5);
put("The Result is: ");
var7 := var5 * var6;
put(var7);
end find;
NOTE: i might have mixed the logic somewhere because the answer is not correct, please correct the logic
anyway the functions will be used just like i have wrote in my code...
Good Luck...
:( mera ye error aa raha hai
Error - At least one procedure is required in main file
do u know keh kia problem ahi ?
ahhhh finally got mine :) Allhamdulillah :)
i think we have to pass value "7" in main.
Ap ne r ki value initialize ki hui hai, see this: In the main program you will use 7 as the value of r.
your error means that you must write code inside the 'procedure' it is like 'main' in C...
@ this is just an idea how to use the functions...
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post