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

Fibonacci in windows assmbly language, Write an assembly program that compu...

Write an assembly program that computes Fibonacci numbers 2-5. a. Assume Fib(0)=0 and Fib(1)=1. b. Store Fib(2) in EAX, Fib(3) in EBX, Fib(4) in ECX and Fib(5) in EDX. c. Use a LOO

Write a program that lets the user play an adventure game, Let the player (...

Let the player (denoted U in the diagram below) navigate around the board until she wins the game by finding the exit or is killed by a monster. A player begins the game with a sli

I have to create three batch files, I have to create a bank atm machine usi...

I have to create a bank atm machine using MS-DOS. I am struggling to create LIST ALL ACCOUNTS ROLL-BACK TRANSACTIONS ACCESS AN ACCOUNT

Write a program that makes a drawing of a skyscraper, 1. Write a program th...

1. Write a program that figures out how long it will take to pay off a credit card by making payments of $10 each month. Take care to avoid infinite loops. (How would a bank preven

Sql vb integration, I need an application that will gather data from one SQ...

I need an application that will gather data from one SQL Database and update another. Data is contained in dbo.CallList with following fields: Customer_ID, AlreadyPickedUp, Phone_N

The .net framework 3.5, Architecture and Components The .NET Framework 3.5 ...

Architecture and Components The .NET Framework 3.5 The .NET Structure (pronounced dot net) is an application framework that works generally on Enthusiasm Microsoft windows. It has

Frotran 2000, Please explain about sub programming.

Please explain about sub programming.

Write a program to draw the fish, Write a program to draw the figure shown ...

Write a program to draw the figure shown below. the program must provide: a. Close the fish's mouth slowly (at least 5 moves from the original position to close the mouth) b.

Program for implement xslt, The aim of this task is to gain experience in u...

The aim of this task is to gain experience in using the popular Web languages XSLT, XQuery, DTD, XML Schema and RDF. The Content: The University is organizing a stage show wh

Java program, Write a program to calculate amount after n number of years b...

Write a program to calculate amount after n number of years by inputting principal at the rate of 8% interest.

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