Question
Create a C# application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and their sum. The SalesTransaction class contains the following fields:
Create a C# application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and their sum.
The SalesTransaction class contains the following fields:
- Name - The salesperson's 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. One 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 the commission rate to 0.
The third constructor accepts a name and sets all the other fields to 0.
An overloaded + operatoradds the sales values for two SalesTransaction objects and returns a new SalesTransaction object.
Please use this format
using static System.Console;
class SalesTransactionDemo
{
static void Main()
{
// Write your main here.
}
public static void Display(SalesTransaction s)
{
// Write your Display() method here.
}
public static void DisplayTotal(SalesTransaction s)
{
// Write your DisplayTotal() method here.
}
}
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