10.27 LAB*: Program: Online shopping cart (Part 1) (1) Create three files to submit: • ItemToPurchase.h - Class declaration • Item ToPurchase.cpp - Class definition main.cpp - main() function Build the Item ToPurchase class with the following specifications: ● Default constructor ● Public class functions (mutators & accessors) o SetName() & GetName() (2 pts) o SetPrice) & GetPrice() (2 pts) o SetQuantity & GetQuantity0 (2 pts) Private data members ostring itemName - Initialized in default constructor to "none" oint itemPrice - Initialized in default constructor to 0 oint itemQuantity - Initialized in default constructor to 0 ● (2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call cin.ignore() to allow the user to input a new string. (2 pts) Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 (3) Add the costs of the two items together and output the total cost. (2 pts) Ex: TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13
10.27 LAB*: Program: Online shopping cart (Part 1) (1) Create three files to submit: • ItemToPurchase.h - Class declaration • Item ToPurchase.cpp - Class definition main.cpp - main() function Build the Item ToPurchase class with the following specifications: ● Default constructor ● Public class functions (mutators & accessors) o SetName() & GetName() (2 pts) o SetPrice) & GetPrice() (2 pts) o SetQuantity & GetQuantity0 (2 pts) Private data members ostring itemName - Initialized in default constructor to "none" oint itemPrice - Initialized in default constructor to 0 oint itemQuantity - Initialized in default constructor to 0 ● (2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call cin.ignore() to allow the user to input a new string. (2 pts) Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 (3) Add the costs of the two items together and output the total cost. (2 pts) Ex: TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Can I please get help for this question. There are three files required.
1). Main.cpp
#include <iostream>
using namespace std;
#include "ItemToPurchase.h"
int main() {
/* Type your code here */
return 0;
}
2) ItemToPurchase.cpp
#include <iostream>
using namespace std;
#include "ItemToPurchase.h"
/* Type your code here */
3) ItemToPurchase.h
#ifndef ITEM_TO_PURCHASE_H
#define ITEM_TO_PURCHASE_H
#include <string>
using namespace std;
/* Type your code here */
#endif
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY