Question
-function defination to find height of male and female child unitm:String:= --GLOBAL VARIABLES CAN BE ACCESSED IN ANY FUNCTION unitf:String:= function Funcheight (gender
-function defination to find height of male and female child unitm:String:=" " --GLOBAL VARIABLES CAN BE ACCESSED IN ANY FUNCTION unitf:String:=" " function Funcheight (gender : Char,father_height : Float,mother_height : Float) return Float is Hmale:Float; Fmale:Float; begin if gender = 'M' then Hmale:=((mother_height*15/12)+father_height)/2; return Hmale; elsif gender = 'F' Fmale:=((father_height*14/13)+mother_height)/2; return Fmale; else Ada.Text_IO.Put_Line("Enter the correct gender of the child); end if; end Func;
--Main program
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; --variable declaration procedure Main is hfather: Float; hmother: Float; height: Float; gen: Char; begin Put_Line("Enter the height of father in inch/centimeter/feet"); Put_Line("Enter the unit 'f' for feet,'c' for centimeter,'i' for inch") get(unitf); -- get the height of father Put_Line("Enter the height"); get(hfather); -- unit conversation is done here in the following if unitf = 'c'then hfather := hfather x .393709 elsif unitf = 'f' then hfather := hfather x 12; endif; Put_Line("Enter the height of mother inch/centimeter/feet"); Put_Line("Enter the unit 'f' for feet,'c' for centimeter,'i' for inch"); get(unitm); -- get the height of mother Put_Line("Enter the height"); get(hmother); -- unit conversation is done here in the following if unitm = 'c'then hmother := hmother x .393709 elsif unitm = 'f' then hmother := hmother x 12; endif; Put_Line("Enter the gender of the child M/F"); get(gen); height:= Funcheight(gen,hfather,hmother); -- Function call to calculate the height of male/female child Put_Line("Height of child in inches is"); put(height); end Main;
MY CODE WON'T COMPILE PLEASE HELP! THE PROGRAMMING LANGUAGE IS ADA PROGRAMMING LANGUAGE!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started