(Solved) : Part 1 Implement 3 Classes Date Transaction Transaction List Date Represents Date Second 6 Q26644861 . . .
Part 1:
You are to implement 3 classes: Date, Transaction, andTransaction List.
Date represents a date, down to the second. It has 6 privatevariables: year representing the year, month representing themonth, day representing day, hour representing the hour, minuterepresenting the minute, and second representing second. There arealso 4 public functions. The constructor takes in values for theprivate variables and assigns them. to_string() converts the dataof the class to a string. operator<() overloads the <operation for Date objects when doing comparisons.operator<<() overrides the << operation for Dateobjects when sending the Date object to and output stream.
Transaction represents a transaction that was ran by a company.Each transaction has a price, the value that was processed by thecompany, and a name, the person who processed the transaction. EachTransaction object has 5 public functions. get_price() returns thevalue processed in the transaction. get_name() returns the name ofthe person who processed the transaction. Transaction() is theconstructor that assigns the values of price and name. to_string()converts the data of the class to a string. operator<<()overrides the << operation for Transaction objects whensending the Transaction object to and output stream. CORRECTION TOUML: in the constructor, the variable names are p and n.
Transaction_List represents a list of transactions stored in amap. This map has keys of Dates and values of Transactions. Thislist is able to add transactions, list all transactions, get theaverage transaction, delete a transaction when given a date, anddelete all transactions by a certain employee. When deleting atransaction, a useful error message must be displayed to the userif unsuccessful. This list should also determine who gets a bonus.Bonuses are determined differently than in Homework #3. In thishomework, it is whoever rang up the highest total value oftransactions, not just the number. Also there are to_string and anoperator<< functions that function similarly to the previoustwo classes.
Part 2: main.cpp
In the main cpp, you must create a menu where the user can selectdifferent options. These options must include printing out the listof transactions, adding a new transaction, deleting a currenttransaction by date, deleting all transaction by a certainemployee, getting the average transaction, and getting the name ofthe person who earned the bonus. Please note that menus may have asubmenu or require additional input, such as asking for the date,price, and name.
Here is an example menu:
Welcome to the Transaction List Management Solution. Please make aselection from the following menu:
1: Print all transactions
2: Add a transaction
3: Delete a transaction(s)
4: Average transaction value
5: Bonus winner ? |
Transaction List ransactions :map Date, Transaction> + Transaction List() +add transaction(date: Date, transaction : Transaction) : bool +list transactions() +get average transaction): double + bonus): string +to string): string +operator<c(ost:ostream&,trans list two: const Transaction List&): ostream& + delete transaction_by date(d : Date) + delete transactions by namein : strin ns price: double year: int month : int day: int hour: int minute: int second: int in +get price) : doubl +get_name): string Transaction(price : double, name: string) to string): string +Dately m : int, d:int, h: int, min: int, s: int) to string): string +operator<(date two: const Date&):bool rator<<(ost: ostream&, date two: const Date&): ostream& Show transcribed image text
Expert Answer
Answer to Part 1 Implement 3 Classes Date Transaction Transaction List Date Represents Date Second 6 Q26644861 . . .
OR