1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kryger [21]
2 years ago
12

Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th

eir sum. The SalesTransaction class contains fields for a salesperson name, sales amount, and commission and a readonly field that stores the commission 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 the 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 + operator adds the sales values for two SalesTransaction objects.
Computers and Technology
1 answer:
crimeas [40]2 years ago
8 0

Answer:

Explanation:

The following code is all written in Java, first I will add the object initialization and declaration code that can be added to the main method of any program. Then I have also written the entire SalesTransaction class as the question was not clear as to exactly which was needed.

//Object Creation to copy and paste into main method

SalesTransaction sale1 = new SalesTransaction("Gabriel", 25, 5);

SalesTransaction sale2 = new SalesTransaction("Daniela", 5);

SalesTransaction sale3 = new SalesTransaction("Jorge");

//SalesTransaction class with three constructors

package sample;

class SalesTransaction {

   String name;

   int salesAmount, commission;

   private int commissionRate;

   public SalesTransaction(String name, int salesAmount, int rate) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = rate;

       commission = salesAmount * rate;

   }

   public SalesTransaction(String name, int salesAmount) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = 0;

   }

   public SalesTransaction(String name) {

       this.name = name;

       this.salesAmount = 0;

       this.commissionRate = 0;

   }

}

You might be interested in
Which of the following is a preferable method to secure wireless access in a SOHO?
NARA [144]
Use a Ghost program follow throught with 2hyttlg5:6\:56
6 0
3 years ago
Place the steps in order for creating a filter in Outlook 2016.
Kitty [74]

Answer:

the above is correct

Explanation:

5 0
2 years ago
Which data validation alert style should you use to prevent the user from entering invalid data?
mario62 [17]

Answer:

stop

Explanation:

If you set the error alert style to Stop, then you are asking Excel to prevent the user from typing in an invalid value.

5 0
2 years ago
Circuitry can be either basic or ___________.
Sonja [21]
I think it would be A. Ohm's law.
hope this helps.
6 0
2 years ago
Read 2 more answers
Is the type of vision useful in sending motion and objects outside normal vision
nlexa [21]
Yes it is in fact it is usful
8 0
2 years ago
Other questions:
  • The _____ icon looks like a clipboard with a page of paper attached. Cut Copy Paste Clipboard
    5·1 answer
  • tuition $36,620 room and board $12,900 books and fees $2,450 transportation $3,100 other $1,330 . Emily is using the table to de
    8·2 answers
  • Why students might want headsets for their computers?
    11·1 answer
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    14·2 answers
  • Together, what do the divisions of the DHSMV do?
    12·1 answer
  • What is the difference between primary storage,secondary storage and offline storage what type of storage can be
    6·2 answers
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • The Fibonacci numbers are the numbers
    15·1 answer
  • A member function of a derived class may not have the same name as a member function of a base class
    9·1 answer
  • According to Chargaff's data, ________ must pair with ________, and ________ must pair with ________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!