






#include <iostream>
#include <cstdlib>
using namespace std;
struct expenses
{
string desc;
double amount;
};
void show_all(expenses *exp, int n)
{
int i = 0;
if (n == 0)
cout << "\nThere is no expense entry available\n"
<< endl;
else
{
cout << "Expenses: " << endl;
while (i < n)
{
cout << "AMOUNT(" << exp[i].amount << ") DESC("
<< exp[i].desc << ")" << endl;
i++;
}
}
}
void spend(expenses *exp, int n)
{
double amount;
string desc;
getline(cin, exp[n].desc);
while (1)
{
cout << "Please enter the description for the expense:
";
getline(cin, exp[n].desc);
if (exp[n].desc != "")
break;
cout << "Invalid Description. Description cannot be empty"
<< endl;
}
char am[100];
while (1)
{
cout << "Please enter the amount: ";
cin >> am;
exp[n].amount = atof(am);
if (exp[n].amount > 0)
break;
cout << "Invalid amount. Amount cannot be negative or string.
Please try it again." << endl;
}
cout << "AMOUNT(" << exp[n].amount << ") DESC("
<< exp[n].desc << ")" << endl;
}
void search_amount(expenses *exp, int n)
{
int i = 0, search;
cout << "Please enter the amount:";
cin >> search;
while (i < n)
{
if (exp[i].amount >= search)
{
cout << "AMOUNT(" << exp[i].amount << ") DESC("
<< exp[i].desc << ")" << endl;
}
i++;
}
}
void search_desc(expenses *exp, int n)
{
string search;
cout << "Please enter the search string: ";
cin >> search;
int i = 0, j, k;
j = 0;
while (j < search.length())
{
search[j] = tolower(search[j]);
j++;
}
while (i < n)
{
string d_str = exp[i].desc;
j = 0;
while (j < exp[i].desc.length())
{
d_str[j] = tolower(d_str[j]);
j++;
}
if (exp[i].desc.find(search) != string::npos)
{
cout << "AMOUNT(" << exp[i].amount << ") DESC("
<< exp[i].desc << ")" << endl;
}
i++;
}
}
int main()
{
int option, n = 0;
expenses exp[100];
cout<<"Welcome to my expense tracker.\n"<<endl;
do
{
cout << "\nExpense Tacking Menu:" << endl;
cout << "\t1. show all\n\t2. spend\n\t3. search expenses
containing this string\n\t4. search expenses with greater than or
equal to this amount\n\t5. exit" << endl;
cout << "Enter your option: ";
cin >> option;
switch (option)
{
case 1:
show_all(exp, n);
break;
case 2:
spend(exp, n);
n++;
break;
case 3:
search_desc(exp, n);
break;
case 4:
search_amount(exp, n);
break;
case 5:
exit(0);
break;
default:
cout << "Invalid choice" << endl;
}
} while (option != 5);
}
screenshot:








OUTPUT:

I need help writing this code in C++ and I’m using xcode for mac the objective...
Please I need help a sample code is provided below of the
output
Description This project is an enhancement of your previous project using OOP concepts. You'lI define class and instantiate objects instead of using struct to implement your design 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...
Need help writing this code in python.
This what I have so far.
def display_menu():
print("======================================================================")
print(" Baseball Team Manager")
print("MENU OPTIONS")
print("1 - Calculate batting average")
print("2 - Exit program")
print("=====================================================================")
def convert_bat():
option = int(input("Menu option: "))
while option!=2:
if option ==1:
print("Calculate batting average...")
num_at_bats = int(input("Enter official number of at bats:
"))
num_hits = int(input("Enter number of hits: "))
average = num_hits/num_at_bats
print("batting average: ", average)
elif option !=1 and option !=2:
print("Not a valid...
All commands must be in the command line. The expense data file is separate. Programming Project #2: Manage Spending Using Commands Objectives: • Understand how to create and manipulate list of objects using array or vector class • Handle input errors and invalid values • Design and create a well-structure program using C++ basic programming constructs and classes. Description: Each “expense” contains 2 values: the spending amount (double) and its description (string) Here is an example of the “expense” data...
I need this code to be written in C language. Also, I'm using
Xcode on mac so I need the steps in order to know how to do
it.
Please save the program with the name 'files.c' Write a program that merges two files as follows. The two files are in the docsharing which you can download it. One file will contain usernames (usernames.txt): foster001 smith023 nyuyen002 The other file will contain passwords (passwords.txt): x34rdf3e P43e4rdd w32eds22 The program should...
I need help with this code. I'm using C++ and Myprogramming lab to execute it. 11.7: Customer Accounts Write a program that uses a structure to store the following data about a customer account: Customer name Customer address City State ZIP code Telephone Account balance Date of last payment The program should use an array of at least 20 structures. It should let the user enter data into the array, change the contents of any element, and display all the...
I need help modifying this code please ASAP using C++
Here is what I missed on this code below
Here are the instructions
Here is the code
Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...
Please help with this C++ code. If possible comment the code and please send screenshots of the code. This assignment involves creating a program to track employee information. Keep the following information on an employee: Employee ID (string) Last name (string) First Name (string) Birth date (string as MM/DD/YYYY) Gender (M or F, single character) Start date (string as MM/DD/YYYY) Salary per year (double) Thus you must create a class that has all of this, and get/set methods for each...
I need MIPS code for this program Translate the following C++ program to MIPS assembly program (Please explain each instruction of your code by a comment and submit a .asm file) // Example program #include <iostream> #include <string> using namespace std; int main() { const int ADULT_CHOICE= 1, CHILD_CHOICE= 2, SENIOR_CHOICE= 3, QUIT_CHOICE= 4, ADULT = 250, CHILD = 200, SENIOR = 350; int choice, months; int charges = 0; do { cout <<"\n\t\tHealth Club Membership Menu\n\n" <<"1. Standard Adult...
For Project 02 you’re going to take starter code I’m providing (See in BlackBoard under Projects->Project 02). The zip file contains a P02.java, a HelperClass.java, and an enumeration under Money.java. The only coding you’ll do will be in P02.java. I’ve already provided you with the menu and switch as well as all the methods you’ll need stubbed out. Your assignment is to take the program and complete it without adding any more methods but merely adding code to those stubbed...
Plz give me correct code and screen shots for this question by using SASM !!!!!!!! Implement the following working C++ program in assembler. Submit assembler code and screen shot. #include <iostream> #include <iomanip> using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A do-while loop // allows the program to repeat until the user selects menu choice 4. int main() { // Constants for membership rates const...