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
Which of these is NOT one of the main parts of an email?
slega [8]
I think the answer is c
3 0
3 years ago
Read 2 more answers
Which of the following is an example of an application software?
pishuonlain [190]
Word processing software
6 0
2 years ago
someone who protects valuable online information, like phone numbers and passwords would be considered​
charle [14.2K]

Answer: i believe a digital citizen

i am not 100% sure about that answer but i reaserached a little and thats what i found :)

I hope this helps u out a little a thank and a brainlist would be greatly appreciatecd :)

6 0
3 years ago
a. Show the output of the following program: 1: public class Test { 2: public static void main ( String [] args ) { 3: A a = new
faust18 [17]

Answer:

See attached file.

Explanation:

See attached file.

Download txt
3 0
3 years ago
Which of the following is not an assessment of your fitness to drive
Ivan

Answer:

C. Am I carrying money?

Explanation:

The options are:

A. Am I awake and alert?

B. Am I emotionally sound?

C. Am I carrying money?

D. Am I physically able?

The correct option is certainly C. Am I carrying money? It can also be a concern if you are worrying since we don't have money. However, here its mentioned, we are not carrying, and it's not like we don't have money, and hence, it is not going to affect our mindset. Hence, it is not an assessment of anybody's fitness to drive.

3 0
3 years ago
Other questions:
  • Background Susan finished work on system architecture issues, and her system design specification was approved. Now she is ready
    15·1 answer
  • Business Risks are ​
    15·1 answer
  • Okay so, not really a question but whatever it’s been bothering me.
    9·2 answers
  • What fields of engineering are in Biomedical
    7·1 answer
  • The diagnostic test that involves watching a computer monitor with alternating checkerboard patterns while an eeg is performed i
    11·2 answers
  • What is the difference between player-centric game design and designer-centric game design? How does a player-centric game assis
    7·1 answer
  • Clickable text or image that takes you to a different site
    15·1 answer
  • Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:
    5·1 answer
  • HELP ASAP, AND YES I KNOW, WRONG CATEGORY. SORRY!
    10·2 answers
  • Cloud architects have been largely replaced by ScrumMasters.<br><br> True<br><br> False
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!