Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a bash script named MyWallet.sh managing a simple bill system. Every bill corresponds to a record (line) in a text file named bills.txt (if

Write a bash script named MyWallet.sh managing a simple bill system. Every bill corresponds to a record (line) in a text file named bills.txt (if this file is inexistent, create it). Each record consists of 7 fields (record ID, category, detail, amount, year, month, day) separate by percent sign (%).

e.g.:

1%restaurant%subway%5.58%2016%2%11

2%gas station%shell%20.15%2016%3%1

-No percent sign (%) in each field.

-The record ID is unique, and generated by this system automatically. (when create a new record, the ID should be the last records ID number + 1.)

-The category, detail, and amount are input by user.

-The date (year, month,day) is generated by this system by using the record creation time. (Year: date +%Y ; Month: date +%m ; Day: date +%d)

-MyWallet.sh should provide a menu with following functionalities that users can choose from at the top level menu:

1. Enter a to add a new bill Ask for category

Ask for detail

Ask for amount

Generate record ID and date

Add this new record into bills.txt file

At the end, print New bill added successfully

Provide option t for Try again and b for Back to main menu

2.Enter d to remove a bill

Ask for record ID

Examine if this record exits. if no, print a message No such record!, otherwise, display this record and remove it from bills.txt file.

Provide option t for Try again and b for Back to main menu

3.Enter c to count amount

Ask for time range (start date(year, month,day) and end date(year,month,day))

Count and display amount of all bills in this time period.

Provide option t for Try again and b for Back to main menu

4. Enter v to view bills

Ask for search type (by category, by time, or by record ID)

Ask for category if by category Ask for time range if by time

Ask record ID if by record ID

Display all bills satisfied the condition

Provide option t for Try again and b for Back to main menu

5.Enter q to quit this system

Terminate this system

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago