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
Mekhanik [1.2K]
2 years ago
8

(1) Create three files to submit:

Computers and Technology
1 answer:
Sindrei [870]2 years ago
6 0

Answer:

We have the files and codes below with appropriate comments

Explanation:

ItemToPurchase.h:

#pragma once

#ifndef ITEMTOPURCHASE_H_INCLUDED

#define ITEMTOPURCHASE_H_INCLUDED

#include<string>

#include <iostream>

using namespace std;

class ItemToPurchase

{

public:

    //Declaration of default constructor

    ItemToPurchase();

    //Declaration of SetName function

    void SetName(string ItemName);

    //Declaration of SetPrice function

    void SetPrice(int itemPrice);

    //Declaration of SetQuantity function

    void SetQuantity(int itemQuantity);

    //Declaration of GetName function

    string GetName();

    //Declaration of GetPrice function

    int GetPrice();

    //Declaration of GetQuantity function

    int GetQuantity();

private:

    //Declaration of itemName as

    //type of string

    string itemName;

    //Declaration of itemPrice as

    //type of integer

    int itemPrice;

    //Declaration of itemQuantity as

    //type of integer

    int itemQuantity;

};

#endif

ItemToPurchase.cpp:

#include <iostream>

#include <string>

#include "ItemToPurchase.h"

using namespace std;

//Implementation of default constructor

ItemToPurchase::ItemToPurchase()

{

    itemName = "none";

    itemPrice = 0;

    itemQuantity = 0;

}

//Implementation of SetName function

void ItemToPurchase::SetName(string name)

{

    itemName = name;

}

//Implementation of SetPrice function

void ItemToPurchase::SetPrice(int itemPrice)

{

    this->itemPrice = itemPrice;

}

//Implementation of SetQuantity function

void ItemToPurchase::SetQuantity(int itemQuantity)

{

    this->itemQuantity = itemQuantity;

}

//Implementation of GetName function

string ItemToPurchase::GetName()

{

    return itemName;

}

//Implementation of GetPrice function

int ItemToPurchase::GetPrice()

{

    return itemPrice;

}

//Implementation of GetQuantity function

int ItemToPurchase::GetQuantity()

{

    return itemQuantity;

}

main.cpp:

#include<iostream>

#include<string>

#include "ItemToPurchase.h"

using namespace std;

int main()

{

    //Declaration of ItemToPurchase class objects

    ItemToPurchase item1Cart, item2Cart;

    string itemName;

    //create a variable names like itemPrice

    //itemQuantity,totalCost as type of integer

    int itemPrice;

    int itemQuantity;

    int totalCost = 0;

    //Display statement for Item1

    cout << "Item 1:" << endl;

    cout << "Enter the item name : " << endl;

    //call the getline function

    getline(cin, itemName);

    //Display statememt

    cout << "Enter the item price : " << endl;

    cin >> itemPrice;

    cout << "Enter the item quantity : " << endl;

    cin >> itemQuantity;

    item1Cart.SetName(itemName);

    item1Cart.SetPrice(itemPrice);

    item1Cart.SetQuantity(itemQuantity);

    //call cin.ignore() function

    cin.ignore();

    //Display statement for Item 2

    cout << endl;

    cout << "Item 2:" << endl;

    cout << "Enter the item name : " << endl;

    getline(cin, itemName);

    cout << "Enter the item price : " << endl;

    cin >> itemPrice;

    cout << "Enter the item quantity : " << endl;

    cin >> itemQuantity;

    item2Cart.SetName(itemName);

    item2Cart.SetPrice(itemPrice);

    item2Cart.SetQuantity(itemQuantity);

    //Display statement

    cout << "TOTAL COST : " << endl;

    cout << item1Cart.GetName() << " " << item1Cart.GetQuantity() << " @ $" << item1Cart.GetPrice() << " = " << (item1Cart.GetQuantity()*item1Cart.GetPrice()) << endl;

    cout << item2Cart.GetName() << " " << item2Cart.GetQuantity() << " @ $" << item2Cart.GetPrice() << " = " << (item2Cart.GetQuantity()*item2Cart.GetPrice()) << endl;

    totalCost = (item1Cart.GetQuantity()*item1Cart.GetPrice()) + (item2Cart.GetQuantity()*item2Cart.GetPrice());

    cout << endl;

    cout << "Total : $" << totalCost << endl;

    return 0;

}

You might be interested in
When a computer or digital device is used as a storage device or in the facilitation of an offense, it is argued to be ____ to t
Katen [24]

Answer:

Incidental.

Explanation:

When a computer or digital device is used as a storage device or in the facilitation of an offense, it is argued to be incidental to the offense.

For instance, the list of customers used by human traffickers is considered to be generated through an incidental system.

8 0
2 years ago
What role does the automated surface observing system.
Ilya [14]

Answer: The ASOS systems serves as the nation's primary surface weather observing network. ASOS is designed to support weather forecast activities and aviation operations

6 0
2 years ago
Read 2 more answers
Few companies today could realize their full-potential business value without updated ________. Select one: a. IT investments ma
Alenkasestr [34]

Answer:

b. IT infrastructures and services

Explanation:

IT infrastructure or information technology infrastructure refers to the various components involved in the functioning of an IT enabled operations. These components include; hardware, software, network resources, etc.

It is usually internal to an organization and deployed within the confines of its own facilities.

6 0
3 years ago
What special enterprise VPN supported by Cisco devices creates VPN tunnels between branch locations as needed rather than requir
castortr0y [4]

Answer:

Dynamic Multipoint VPN

Explanation:

4 0
2 years ago
What do customers use to access the internet, usually for a monthly fee?
kati45 [8]
To search things like answers,order things on Amazon,or go watch videos on Youtube
4 0
3 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • Plz help! 3 questions! 1.The ideal light to use is.... A.front light B.a combination of side and back light C.a combination of f
    10·1 answer
  • . What is automated testing?
    10·1 answer
  • What is the root of the tree?
    6·1 answer
  • Do You assign the Needs Met rating before assigning the page quality (PQ) rating?
    11·1 answer
  • Different between internet and email​
    5·1 answer
  • Which four of the following qualify as fair use?
    11·2 answers
  • Who are the following furries?
    10·2 answers
  • Why would researching the average earnings by major and by career be useful to you as you choose an institute for higher educati
    10·1 answer
  • Most case fans have standard _______________ connectors that are easy to plug in but can be forced to be connected the wrong way
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!