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

C program with creation of child process using fork system, Problem 6. ...

Problem 6. Demonstrate how and when can you use the commands- vi, cat, chmod, grep, man, pwd, ps, kill, mkdir, rm demonstrating how and when the above 10 commands can be

Example of undetermined coefficients, Example :  Solve the following differ...

Example :  Solve the following differential equation. y (3)   -  12 y''+48 y' + 64 y = 12 - 32 e -8t + 2 e 4t Solution :    We first require the complementary solution

Calculating percentage differences-circuit diagram, In the procedure sectio...

In the procedure section, it is important to have a clear circuit diagram with component values and a brief, but accurate description of each step taken. 1. Tables for both the

Define remote procedure call, Problem: (i) Define Remote Procedure Cal...

Problem: (i) Define Remote Procedure Call (RPC). (ii) Explain with diagram how RPC works? (iii) A remote procedure is uniquely defined by (a) Program number. (b)

Project , You get a contract to implement a simple Java application that pr...

You get a contract to implement a simple Java application that process NBA team roster : your application has to read the NBA team roster from a text file and then print each playe

Computes the least squares fit of the data, Your solution to the problem sh...

Your solution to the problem should be housed within a while loop, which allows the grader to test your solution repeatedly without having to re-execute the script, as shown in cla

Program for keep track of the titles of ebooks, This assignment will just f...

This assignment will just focus on NookyKindle eBook orders.  That is, we'll be keeping track of the titles of eBooks and the number of orders for that particular eBook during a pa

Language processors, explain steps of program execution in language process...

explain steps of program execution in language processors

Sytem call, use of exec and nice system call

use of exec and nice system call

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