Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following function in Scheme/DrRacket ! Please do not use loops , as l

ID: 3733128 • Letter: W

Question

Write the following function in Scheme/DrRacket! Please do not use loops, as loops are not native to Scheme/DrRacket R5RS. Instead, use case analysis and recursion.

4. (4 points) Write a Scheme function int-to-words that takes a nonneg- ative integer between 0 and 99, inclusive, as a parameter and returns a list of words corresponding to the integers reading in English. Make your function as short as possible; i.e., don't write a COND statement with 100 tests. Example calls to your function are given below:

Explanation / Answer

ANSWER:

THE FOLLOWING DATA REPRESENTS WITH RESPECT TO THE GIVE DATA WHICH IS AS FOLLOWS;

#include<iostream>

using namespace std;

int intTowords(int value);

main()

{

int a;

intTowords(54);

}

int intTowords(int value)

{

int a,b;

string c,d;

a=value%10;

b=value-a;

cout<<b<<" "<<a<<" ";

if(b==11)

c="eleven";

else if(b==12)

c="twelve";

else if(b==13)

c="thirteen";

else if(b==14)

c="fourteen";

else if(b==15)

c="fifteen";

else if(b==16)

c="sixteen";

else if(b==17)

c="seventeen";

else if(b==18)

c="eighteen";

else if(b==19)

c="nignteen";

else if(b==20)

c="twenty";

else if(b==30)

c="thirty";

else if(b==40)

c="fourty";

else if(b==50)

c="fifty";

else if(b==60)

c="sixty";

else if(b==70)

c="seventy";

else if(b==80)

c="eighty";

else

c="ningty";

if(a==1)

d="one";

else if(a==2)

d="two";

else if(a==3)

d="t7hree";

else if(a==4)

d="four";

else if(a==5)

d="five";

else if(a==6)

d="six";

else if(a==7)

d="seven";

else if(a==8)

d="eight";

else if(a==10)

d="ten";

else

d="nine";

cout<<c<<" "<<d;

}