NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#!/bin/bash
#bonus.sh

readSalesperson()
{
echo "Enter the number of salesperson:" #display message to put number salesperson
read input #taking the value of number
if [[ $input =~ ^[0-9]*$ ]] #check the value in number form
then
readn
else
readSalesPerson #read the salesperson
fi # close for loop
}
readn()
{
for (( a = 0; a < $input; a++ )) #satrting for loop for input function
do
echo "Enter the name of sales person $a: " #display the name of sales
readsalesname #read salesname
if [[ $salesname =~ ^[A-Z|a-z]+$ ]] #pressing the s key from keyboard to sort in alphabetical
then
name1[$a]="$salesname" #read the value of $a

echo "Enter quarterlysales of a person $a: " #enter the value of quartarley
read quarterlysales1
if [[ $quarterlysales1 =~ ^[0-9]*$ ]] #check the number only while input
then
quarterly1[$a]="$quarterlysales1" #check the value of quarterly
fi


else
readn
fi

if [[ $quarterlysales1 -gt 1000000 ]] #display the bonus
then
bonus[$a]="1,500"
elif [[ $quarterlysales1 -le 999999 && $quarterlysales1 -ge 1000000 ]]
then
bonus[$a]="750"
elif [[ $quarterlysales1 -le 99999 ]]
then
bonus[$a]="0"
fi
done
displayname #save all file in savedarjun.txt
displayname>> savedarjun.txt
}

displayname()
{
for (( a = 0; a < $input; a++ )) #listing all salesname and sales quarterly
do
echo "Names:" ${name1[@]} #display name of sales
echo "Quarterlysales:" ${quarterly1[@]} #displat quarterly sales
echo "Bonus:" ${bonus[@]} #display bonus
option
done

}
option(){
echo "Press S for sorting sales and A for alphabetic" #user need tp press s key for sorting sales and pressing a key from keybroad for sorting alphabetical order
read input
if [[ $input =~ ^[A]$ ]] || [[ $input =~ ^[a]$ ]] #check input is equal to output for alphabetical
then
bubbleSort1
elif [[ $input =~ ^[S]$ ]] || [[ $input =~ ^[s]$ ]] #using bubble sort for sorting sales
then
bubbleSort
else
exit
fi
}
bubbleSort() #using bubble sort for display the sorting sales and alphabetical order
{
n=${#quarterly1[@]} #this line of code show sorting the salesperson and quarterly in sales
for ((k=0;k<$n;k++))
do
for ((l=0;l<$n;l++))
do
if [[ ${quarterly1[l]} -lt ${quarterly1[$((l+1))]} ]]
then
t=${quarterly1[$j]}
quarterly[$l]=${quarterly1[$((l+1))]}
quarterly[$((l+1))]=$t

t1=${name1[$l]}
name[$l]=${name1[$((l+1))]}
name[$((l+1))]=$t1
fi
done
done
echo ${name1[*]}
echo ${quarterly1[*]}
}

bubbleSort1()
{
n=${#name1[@]} #this line of code show sorting the salesperson and quarterly in alphabetical order
for ((k=0;k<$n;k++))
do
for ((l=0;l<$n;l++))
do
if [[ ${name1[l]} > ${name1[$((l+1))]} ]]
then
t=${name1[$l]}
name[$l]=${name1[$((l+1))]}
name[$((l+1))]=$t

t1=${quarterly1[$j]}
quarterly[$j]=${quarterly1[$((l+1))]}
quarterly[$((l+1))]=$t1
fi
done
done
echo ${name1[*]} #display salesname and quarterly in decending sales form
echo ${quarterly1[*]} #display salesname and quarterly in aplphabetical order
}


continue()
{
echo "Do you want to continue?Press[Yy]" #display the message user can be continue or not
read continue
if [[ $continue =~ ^[Y]$ ]] || [[ $continue =~ ^[y]$ ]]
then
clear
Salesperson
else
exit
fi
}
readSalesperson
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.