Shell script convert the given amount into words, Programming Languages

Assignment Help:

 Convert the given amount into words.

 

echo -e "Enter the amount: \c"

read amt

temp=`grep $amt rupees.txt | wc -l`

if test $temp -gt 0

then

grep -w $amt rupees.txt | cut -d " " -f2

else

rw=""

len=`echo "$amt" | wc -c`

i=1

while test $i -lt $len

do

  temp=`echo "$amt" | cut -c$i`

  if test $i -eq 1

 then

 if test $amt -gt 10

then

 temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | tail -n1`

 rw=`echo "$rw $temp"`

else

temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | head -n1`

 rw=`echo "$rw $temp"`

fi

else

temp=`grep "^$temp" rupees.txt | cut -d " " -f2 | head -n1`

 rw=`echo "$rw $temp"`

 

fi

  i=`expr $i + 1`

done

echo $rw

fi

 

Output

Enter the amount: 66

Sixty Six

Enter the amount: 15

Fifteen

 


Related Discussions:- Shell script convert the given amount into words

Javascript variables and datatypes, Let us first see the skeleton of a Java...

Let us first see the skeleton of a JavaScript file. JavaScript code should be written between the and tags. The value LANGUAGE = "JavaScript" indicates to the browser that J

CMIS 102, Calculate the total price based on several key parts required to ...

Calculate the total price based on several key parts required to build a state-of-the-art gaming computer. The user will have the option of selecting different parts.

Recursion function, Use recursion to de ne a function position which has as...

Use recursion to de ne a function position which has as input an integer, a character and a string and returns the result of inserting the character in the string at the position s

Create a one to two page html document, Task 1 Think about a Web site...

Task 1 Think about a Web site you would like to work on for Assignment 2. For example, you can do a personal interest site, a site for your favourite nonprofit organization,

ARM LANGUAGE, I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

Simple corba program, You are working in charge of a group of programmers a...

You are working in charge of a group of programmers at a software company. Your task is to assess and research CORBA and to produce a report to be given to the programmers detailin

Discuss the php operators, Question 1 Explain the history of Internet ...

Question 1 Explain the history of Internet Question 2 What are the advantages of DHTML? Question 3 Explain the concept of DOM Question 4 How does AJAX work

Java networking, Expertsmind brings you unique solution in java assignment...

Expertsmind brings you unique solution in java assignments Networking The term system selection represents composing applications that do across several gadgets (computers

Complex roots, We will be assuming here that our roots are of the form, in ...

We will be assuming here that our roots are of the form, in this case, r 1,2 = l + mi If we take the first root we'll find the following solution. x l + m i It i

Programming logic???, write c++ source code to find the number of digits i...

write c++ source code to find the number of digits in a given integer? pls ans

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd