Please use C++ Create an application named SalesTransactiobDemo that declares several SalesTransaction objects and displays their values and their sum. The SalesTransaction class contains the following fields: Name - The salesperson name (as a string) salesAmount - The sales amount (as a double) commission - The commission (as a double) RATE - A readonly field that stores the commission rate (as a double). Define a getRate () accessor method that returns the RATE INCLUDE three constructors for the class. On constructor accepts values for the name, sales amount, and rate, and when the sales value is set, the constructor computes the commission as sales value times commission rate. The second constructor accepts a name and sales amount, but sets tge commission rate to 0. The third constructor accepts a name and sets all the other fields to 0. An overloaded + operator adds tge sales values for two SalesTransaction objects and returns a new SalesTransaction object.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Please use C++
Create an application named SalesTransactiobDemo that declares several SalesTransaction objects and displays their values and their sum.
The SalesTransaction class contains the following fields:
Name - The salesperson name (as a string)
salesAmount - The sales amount (as a double)
commission - The commission (as a double)
RATE - A readonly field that stores the commission rate (as a double). Define a getRate () accessor method that returns the RATE
INCLUDE three constructors for the class. On constructor accepts values for the name, sales amount, and rate, and when the sales value is set, the constructor computes the commission as sales value times commission rate.
The second constructor accepts a name and sales amount, but sets tge commission rate to 0.
The third constructor accepts a name and sets all the other fields to 0.
An overloaded + operator adds tge sales values for two SalesTransaction objects and returns a new SalesTransaction object.
In order to prepend the $ to the currency values, the program will need to use the CultureInfo.GetCuktureInfo method. In order to do this, include the statement
using System.Globalization; at tge top of your program and format the output statements as follows:
WriteLinw("This is an example: {0}", value.ToStrinf("C", CuktureInfo.GetCultureInfo("en-US")));
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images