answer.
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
Elina [12.6K]
2 years ago
8

Create two classes. The first, named Sale, holds data for a sales transaction. Its private data members include the day of the m

onth, amount of the sale, and the salesperson's ID number. The second class, named Salesperson, holds data for a salesperson, and its private data members include each salesperson's ID number and last name. Each class includes a constructor to which you can pass the field values. Create a friend function named display()that is a friend of both classes and displays the date of sale, the amount, and the salesperson ID and name. Write a short main()demonstration program to test your classes and friend function.Sample Run
Sale #103 on 12/25/2016 for $559.95 sold by #103 Woods
Sale #106 on 11/15/2016 for $359.95 sold by #106 Hansen
Computers and Technology
1 answer:
olya-2409 [2.1K]2 years ago
4 0

Answer:

A C++ program was used in creating two classes. the code is stated below.

Explanation:

Solution

The C++ program is executed below:

#include<iostream>

using namespace std;

//declare class (will be define later)

class Salesperson;

//class Sale

class Sale

{

  //private members of class

  private:

      string day;

      double amtOfSale;

      int salesPersonId;

 //public methods

  public:

      //constructor that takes day,amount of sale and salesPersonId as parameters

      Sale(string date,double sale,int id)

      {

          //set the private members to the initial values passed

          day=date;

          amtOfSale=sale;

          salesPersonId=id;

      }    

      //declare a friend function that takes objects of the two classes as parameters

      friend void display(Sale,Salesperson);

};  

//define class Salesperson

class Salesperson

{

  //private members of the class

  private:

      int salesPersonId;

      string lastName;    

  //public methods

  public:

      //constructor that takes name and id as parameters

      Salesperson(int id,string name)

      {

          //set the members of the class with the parameters passed

          salesPersonId=id;

          lastName=name;

      }  

      //declare a friend function that takes objects of the two classes as parameters

      friend void display(Sale,Salesperson);

};

//define the friend funtion

void display(Sale saleObj,Salesperson personObj)

{

  //display the sales info using the objects of the two classes

  cout<<"\nSale #"<<saleObj.salesPersonId<<" on "<<saleObj.day<<" for $"<<saleObj.amtOfSale<<" sold by #"<<personObj.salesPersonId<<" "<<personObj.lastName;

}  

int main()

{

  //create object for Sale class and pass default values

  Sale sObj1("12/25/2016",559.95,103);

  //create object for Salesperson class and pass default values

  Salesperson pObj1(103,"Woods");

 

  //create another object for Sale class and pass default values

  Sale sObj2("11/15/2016",359.95,106);

  //create another object for Salesperson class and pass default values

  Salesperson pObj2(106,"Hansen");

  //using the friend function dislay the sales info

  display(sObj1,pObj1);

  display(sObj2,pObj2);

  return 0;

}

You might be interested in
_____ remove the part of an image starting from an edge​
Lapatulllka [165]
I think it’s cropping could be wrong though
4 0
2 years ago
Describe different types of intrusions such as SQL PL/SQL, XML, and other injections.
Finger [1]

<em>Intrusion means unauthorized and harmful activities happening in your system. Any irregularities in the system is considered as intrusion and therefore monitored by administrators and can be detected using Intrusion Detection System. </em>

<em>Examples of Intrusion attacks in a network are: </em>

  • <em>Denial of Service (Dos) - denial of service means flooding the system causing it to crash and unable to respond to a service request. Normally, a DoS attack is facilitated by numbers of hosts sending enormous request to a victim computer. The requests can be in a form of code that would flood the system and making it to unresponsive.  </em>
  • <em>Man in the Middle Attack (MiM) - a hacker would be in the middle of the communication between a client computer and a server computer. The hacker can mimic IPs within the network and steal information then sends it to the intended receiver.  </em>
  • <em>SQL Injection - For websites that runs database like SQL, a code by the hacker can be added to the website and making him gained access to the database information successfully.</em>
8 0
2 years ago
Kaira's company recently switched to a new calendaring system provided by a vendor. Kaira and other users connect to the system,
goldfiish [28.3K]

The service model that Kaira’s company is using is Saas

Explanation

Kaira’s company is using Software as a Service to access their new calendaring system that has been hosted by a 3rd party vendor over the web. It is the work of the SaaS to host specific applications and to deliver these applications to customers over the cloud. With SaaS, Kaira’s company does not need to install their calendaring software on their PCs. Every useful thing they want from their calendaring system can easily be accessed over the internet. All the company will need are personalized accounts with usernames and passwords for their employees to access.

The other different types of Cloud Computing services include;

  • PaaS: A set of tools and services designed to make coding and deploying those applications quick and efficient.
  • IaaS: hardware and software that powers it all – servers, storage, networks, and operating systems.

Learn more:

What is cloud computing?

brainly.com/question/2662575

Explain the three basic types of Cloud computing

brainly.com/question/12967175

#LearnwithBrainly

3 0
1 year ago
enter a formula in cell b10 to return a value of 35000 if the net profit after tax (cell B() is greater than or equal to 350000
Aliun [14]

Step by step explanation:

Statement to be written in cell B10 :

IF ( B9 >= 350000 , 35000, 1000)

Formula:

IF ( logical_test ,  [value_if_true] ,  [value_if_false] )

logical_test = Net Profit After Tax (cell B9)

value_if_true = 35000

(if the Net Profit After Tax (cell B9) is greater than or equal to 350000)

    value_if_false = 1000

(if the Net Profit After Tax (cell B9) is lesser than 350000)


6 0
2 years ago
Read 2 more answers
A cybercrime: Select one: a. Is the act of defaulting on a properly signed agreement entered into upon the internet. b. Can be c
aalyn [17]

The answer is B because cyber crime is when a computer is used to commit criminal activities.

3 0
2 years ago
Other questions:
  • Which of the following is ideal for long distance communication ?
    5·1 answer
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • Use the image below to answer this question.
    14·1 answer
  • A summer camp offers a morning session and an afternoon session.
    5·1 answer
  • Two-dimensional array indexes are listed as
    8·1 answer
  • 2 Name the package that contains scanner class?​
    10·1 answer
  • Performing binary search on an unsorted list will always return the correct answer in O(n) time where n is the length of the lis
    9·1 answer
  • The geographic coordinate system is used to represent any location on Earth as a combination of latitude and longitude values. T
    5·1 answer
  • A credit card company receives numerous phone calls throughout the day from customers reporting fraud and billing disputes. Most
    10·1 answer
  • a key part of staying safe is employing good habits. drag the step number to the proper sequence triple a
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!