Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Classes and Map HW help (Please use C++ 11 Language for Linux) The UML: You will be using a map to store Transaction objects

C++ Classes and Map HW help (Please use C++ 11 Language for Linux)

The UML:

image text in transcribed

You will be using a map to store Transaction objects (values) sorted by Date objects (keys). You will also be making a menu to allow a user to select different options and input data.

Part 1: Classes You are to implement 3 classes: Date, Transaction, and Transaction List.

Date represents a date, down to the second. It has 6 private variables: year representing the year, month representing the month, day representing day, hour representing the hour, minute representing the minute, and second representing second. There are also 4 public functions. The constructor takes in values for the private variables and assigns them. to_string() converts the data of the class to a string. operator

Transaction represents a transaction that was ran by a company. Each transaction has a price, the value that was processed by the company, and a name, the person who processed the transaction. Each Transaction object has 5 public functions. get_price() returns the value processed in the transaction. get_name() returns the name of the person who processed the transaction. Transaction() is the constructor that assigns the values of price and name. to_string() converts the data of the class to a string. operator

CORRECTION TO UML: in the constructor, the variable names are p and n.

Transaction_List represents a list of transactions stored in a map. This map has keys of Dates and values of Transactions. This list is able to add transactions, list all transactions, get the average transaction, delete a transaction when given a date, and delete all transactions by a certain employee. When deleting a transaction, a useful error message must be displayed to the user if unsuccessful. This list should also determine who gets a bonus. Bonuses are determined differently than in Homework #3. In this homework, it is whoever rang up the highest total value of transactions, not just the number. Also there are to_string and an operator

Part 2: main.cpp In the main cpp, you must create a menu where the user can select different options. These options must include printing out the list of transactions, adding a new transaction, deleting a current transaction by date, deleting all transaction by a certain employee, getting the average transaction, and getting the name of the person who earned the bonus. Please note that menus may have a submenu 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 a selection 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 -transactions : map Date, Transaction> + Transaction_List() + add transaction(date Date, transaction Transaction): bool + list transactions() + get_average_transaction() : double + bonus): string + to string: string + operator

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

More Books

Students also viewed these Databases questions

Question

What is the energy of a photon if its frequency is 2.06 1018 s1?

Answered: 1 week ago