Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description: Write a menu-driven program that provides the following options: 1. Show All 2. Spend 3. Search expenses containing this string 4. Search expenses with
Description: Write a menu-driven program that provides the following options: 1. Show All 2. Spend 3. Search expenses containing this string 4. Search expenses with greater than or equal to this amount 5. Exit It allows the user to select a menu option to display all expenses, add new entry, search for a substring and find the list of entries greater a given amount. Requirements: 1. The program must produce similar output as example below. The output should be formatted nicely as given. 2. The program must use array of structs 3. The program must not use global variables. In another words, it must use local variables and pass-by-value or pass-by-reference parameters. 4. The program must define the maximum number of entries such as 100 and keeps track of the actual count of the current number of expenses entered by the user 5. You should not use data file to save or read from. All operations should be done through the use of arrays and array indices. 6. You must write at least 2 functions. Required error handling: The program MUST perform the following checks: 1. Check for invalid amount (negative or 0 number) 2. Description cannot be empty 3. Search is case-insensitive (ignore case, but the user may type in any case).Sample run: D:H}TrackExpensesUsingArray.exe Welcome to my expense tracker. Expense Tracking menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 1 There is no expense entry available. Expense Tracking Honu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Monthly telephone and Internet services Please enter the amount: 45.25 hMOUNT45.25] DESCiMonthly telephone and Internet services} Expense Tracking Honu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Monthly electricJr water and gas Please enter the amount: 200.20 hMOUNT200.2] DESCiMonthly electric, water and gas] Expense Tracking MEnu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Rent Please enter the amount: 1200 AMOUNT {1200) use: {Rent} Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Netflix membership Please enter the amount: 12.90 AMOUNT (12 . 9) DESC (Netflix membership) Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Amazon membership Please enter the amount : 99 AMOUNT (99) DESC (Amazon membership) Expense Tracking Menu: 1 . show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Monthly gym membership Please enter the amount: 50 AMOUNT (50) DESC (Monthly gym membership) Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 1 Expenses : AMOUNT (45. 25) DESC (Monthly telephone and Internet services) AMOUNT (200.2) DESC (Monthly electric, water and gas) AMOUNT (1200) DESC (Rent) AMOUNT (12.9) DESC (Netflix membership) AMOUNT (99) DESC (Amazon membership) AMOUNT (50) DESC (Monthly gym membership) Expense Tracking Menu: 1. show all2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 3 Please enter the search string: membership AMOUNT12.9} DESCiNetflix membership} AMOUNT99} DESCAmazon membership} AMOUNT{SO} DESCMonthly gym membership} Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 3 Please enter the search string: MEMBERSHIP AMOUNT12.9} DESCNetflix membership} AMOUNT99} DESCRmazon membership} AMOUNT{SO} DESCMonthly gym membership} Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 4 Please enter the amount: ED AMOUNT20U.2} DESCiMonthly electricJr water and gas} AMOUNT {12 U 0} use: {Rent} AMOUNT99} DESCRmazon membership} AMOUNT{SO} DESCMonthly gym membership} Expense Tracking menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 4 Please enter the amount: 2DD AMOUNT2DU.2} DESCiMonthly electricr water and gas} AMOUNTlEUO} DESCRent} Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 4 Please enter the amount: 1000 AMOUNT (1200) DESC (Rent) Expense Tracking Menu: 1. show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 2 Please enter the description for the expense: Home repair and improvement Please enter the amount: -1 Invalid amount. Amount cannot be negative or string. Please try it again. Please enter the amount: -100 Invalid amount. Amount cannot be negative or string. Please try it again. Please enter the amount: -1000 Invalid amount. Amount cannot be negative or string. Please try it again. Please enter the amount: 175.75 AMOUNT (175 . 75) DESC (Home repair and improvement) Expense Tracking Menu: 1 . show all 2 . spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5. exit Enter your option: 1 Expenses : AMOUNT (45. 25) DESC (Monthly telephone and Internet services) AMOUNT (200. 2) DESC (Monthly electric, water and gas) AMOUNT (1200) DESC (Rent) AMOUNT (12 . 9) DESC (Netflix membership) AMOUNT (99) DESC (Amazon membership) AMOUNT (50) DESC (Monthly gym membership) AMOUNT (175. 75) DESC (Home repair and improvement) Expense Tracking Menu: show all 2. spend 3. search expenses containing this string 4. search expenses with greater than or equal to this amount 5 . exit Enter your option: 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started