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]
3 years ago
8

(1) Create three files to submit:

Computers and Technology
1 answer:
Sindrei [870]3 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
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of
NeX [460]

The answer is

Recipient's ability to open file

Size of file

Sometimes, it might occur that the email message attachment you’ve sent to someone has an error or is corrupt and thus, limits the recipient ability to open the file. Another factor is the size of the file. All email servers limit the size of the file attached in an email that a recipient can receive mainly because of security reasons. Google Mail, for instance, only allows you to send 25MB only. This might limit the ability to attach files to e-mail messages as well.

3 0
2 years ago
Read 2 more answers
A(n) ____________ is a private data network that creates secure connections over regular internet lines.
Setler79 [48]
VPN is the correct answer
5 0
3 years ago
Which of the following is an example of an inline element? A. B. C. D.
____ [38]
what are the answers??
3 0
2 years ago
What is administrator access? Multiple Choice refers to how quickly a system can transform to support environmental changes perf
IrinaVladis [17]

Answer:

Administrator access is:

refers to the varying levels that define what a user can access, view, or perform when operating a system refers to the time frames when the system is operational

Explanation:

The reasons behind this answer are that in the first place the administrator role is the maximum role an account can have in the operating system. Controlling the different levels of access the rest of the accounts can have on the system. It then is a hierarchical role, not the changes someone can execute in a certain environment, these are called rules.

3 0
3 years ago
Why would a designer choose to use a static layout? Check all of the boxes that apply.
Dafna1 [17]

Answer:

Explanation:a & c

6 0
2 years ago
Other questions:
  • A network administrator is implementing dhcpv6 for the company. the administrator configures a router to send ra messages with m
    6·1 answer
  • The prefix kilo stands for which one of the following values? A. 100 or 102 B. 1000 or 103 C. 1,000,000 or 106 D. 10,000 or 104
    15·2 answers
  • Explain how the principles underlying agile methods lead to accelerated development and deployment of software.
    6·1 answer
  • A transcript must bear a(n)___ to be considered official
    15·2 answers
  • The ____ command creates a subdirectory under a directory. rd md cd ad
    11·1 answer
  • What should you do to help prepare yourself for the delivery of your presentation? you can chose more then one
    8·1 answer
  • Hooollaaaa , todos absolutamente todos quieren borrar esta tarea por que no tiene nada que ver con la materias del colegiooo per
    7·2 answers
  • What does coding mean​
    10·2 answers
  • A security administrator plans to conduct a vulnerability scan on the network to determine if system applications are up to date
    15·1 answer
  • Write the syntax of FOR......NEXT loop​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!