SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
#include "stdafx.h"
#include
using namespace std;
class Inventory
{
private:
int itemNumber;
int quantity;
double cost;
double totalCost;
public:
Inventory()
{
itemNumber = 0;
quantity = 0;
cost = 0;
totalCost = 0;
}
Inventory(int newItemNumber, int newQuantity, double newCost)
{
itemNumber = newItemNumber;
quantity = newQuantity;
cost = newCost;
setTotalCost(quantity, cost); // this can be called as quantity and cost have now been
initialized.
}
void setItemNumber(int)
{
itemNumber = itemNumber;
}
void setQuantity(int)
{
quantity = quantity;
}
void setCost(double)
{
cost = cost;
}
void setTotalCost(int, double)
{
totalCost = quantity * cost;
}
int getItemNumber()
{
return itemNumber;
}
int getQuantity()
{
return quantity;
}
double getCost()
{
return cost;
}
double getTotalCost()
{
return totalCost;
}
};
int main()
{
int itemNumber;
int quantity;
double cost;
double totalCost;
cout << "Enter the Item Number: ";
cin >> itemNumber;
while (itemNumber < 0)
{
cout << "Please enter a positive value for the Item Number: ";
cin >> itemNumber;
}
cout << "Enter the Quantity of the item: ";
cin >> quantity;
while (quantity < 0)
{
cout << "Please enter a positive value for the Quantity of the item: ";
cin >> quantity;
}
cout << "Enter the Cost of the item: ";
cin >> cost;
while (cost < 0)
{
cout << "Please enter a positive value for the Cost of the item: ";
cin >> cost;
}
Inventory information(itemNumber, quantity, cost);
totalCost = information.getTotalCost();
itemNumber = information.getItemNumber();
cost = information.getCost();
quantity = information.getQuantity();
cout << "The Item Number is: " << itemNumber << endl;
cout << "The Quantity is: " << quantity << endl;
cout << "The Cost is: " << cost << endl;
cout << "The Total Cost is: " << totalCost << endl;
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
Solution
#include "stdafx.h"
#include
using namespace std;
class Inventory
{
private:
int itemNumber;
int quantity;
double cost;
double totalCost;
public:
Inventory()
{
itemNumber = 0;
quantity = 0;
cost = 0;
totalCost = 0;
}
Inventory(int newItemNumber, int newQuantity, double newCost)
{
itemNumber = newItemNumber;
quantity = newQuantity;
cost = newCost;
setTotalCost(quantity, cost); // this can be called as quantity and cost have now been
initialized.
}
void setItemNumber(int)
{
itemNumber = itemNumber;
}
void setQuantity(int)
{
quantity = quantity;
}
void setCost(double)
{
cost = cost;
}
void setTotalCost(int, double)
{
totalCost = quantity * cost;
}
int getItemNumber()
{
return itemNumber;
}
int getQuantity()
{
return quantity;
}
double getCost()
{
return cost;
}
double getTotalCost()
{
return totalCost;
}
};
int main()
{
int itemNumber;
int quantity;
double cost;
double totalCost;
cout << "Enter the Item Number: ";
cin >> itemNumber;
while (itemNumber < 0)
{
cout << "Please enter a positive value for the Item Number: ";
cin >> itemNumber;
}
cout << "Enter the Quantity of the item: ";
cin >> quantity;
while (quantity < 0)
{
cout << "Please enter a positive value for the Quantity of the item: ";
cin >> quantity;
}
cout << "Enter the Cost of the item: ";
cin >> cost;
while (cost < 0)
{
cout << "Please enter a positive value for the Cost of the item: ";
cin >> cost;
}
Inventory information(itemNumber, quantity, cost);
totalCost = information.getTotalCost();
itemNumber = information.getItemNumber();
cost = information.getCost();
quantity = information.getQuantity();
cout << "The Item Number is: " << itemNumber << endl;
cout << "The Quantity is: " << quantity << endl;
cout << "The Cost is: " << cost << endl;
cout << "The Total Cost is: " << totalCost << endl;
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

Mais conteúdo relacionado

Semelhante a #include stdafx.h#include iostreamusing namespace std;cl.pdf

template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdfashokadyes
 
I have created a class hasdhedDictionary that implements the Diction.pdf
I have created a class hasdhedDictionary that implements the Diction.pdfI have created a class hasdhedDictionary that implements the Diction.pdf
I have created a class hasdhedDictionary that implements the Diction.pdfallystraders
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfinfo334223
 
Need help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docxNeed help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docxLucasmHKChapmant
 
Given main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfGiven main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfillyasraja7
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum
 
Create a Dynamic Array container with this user interface Ge.pdf
Create a Dynamic Array container with this user interface  Ge.pdfCreate a Dynamic Array container with this user interface  Ge.pdf
Create a Dynamic Array container with this user interface Ge.pdfsktambifortune
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
 
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdfBANSALANKIT1077
 
Character.cpphpp givenCharacter.cpp#include Character.hp.pdf
Character.cpphpp givenCharacter.cpp#include Character.hp.pdfCharacter.cpphpp givenCharacter.cpp#include Character.hp.pdf
Character.cpphpp givenCharacter.cpp#include Character.hp.pdftxkev
 
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptxvectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptxVivekSharma34623
 
Help explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfHelp explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfalmonardfans
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdffathimafancyjeweller
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Daniel Pokusa
 
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfI keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfflashfashioncasualwe
 
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdfHelp please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdfarorastores
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfxlynettalampleyxc
 
Given an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdfGiven an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdfMattCu9Parrd
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++nsm.nikhil
 

Semelhante a #include stdafx.h#include iostreamusing namespace std;cl.pdf (20)

template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdf
 
I have created a class hasdhedDictionary that implements the Diction.pdf
I have created a class hasdhedDictionary that implements the Diction.pdfI have created a class hasdhedDictionary that implements the Diction.pdf
I have created a class hasdhedDictionary that implements the Diction.pdf
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
 
PathOfMostResistance
PathOfMostResistancePathOfMostResistance
PathOfMostResistance
 
Need help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docxNeed help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docx
 
Given main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfGiven main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdf
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
 
Create a Dynamic Array container with this user interface Ge.pdf
Create a Dynamic Array container with this user interface  Ge.pdfCreate a Dynamic Array container with this user interface  Ge.pdf
Create a Dynamic Array container with this user interface Ge.pdf
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
 
Character.cpphpp givenCharacter.cpp#include Character.hp.pdf
Character.cpphpp givenCharacter.cpp#include Character.hp.pdfCharacter.cpphpp givenCharacter.cpp#include Character.hp.pdf
Character.cpphpp givenCharacter.cpp#include Character.hp.pdf
 
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptxvectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
 
Help explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdfHelp explain the code with line comments public class CompletedLis.pdf
Help explain the code with line comments public class CompletedLis.pdf
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!
 
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfI keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
 
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdfHelp please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
 
Given an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdfGiven an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdf
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 

Mais de aashwini4

1. True2. TrueSolution1. True2. True.pdf
1. True2. TrueSolution1. True2. True.pdf1. True2. TrueSolution1. True2. True.pdf
1. True2. TrueSolution1. True2. True.pdfaashwini4
 
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdfaashwini4
 
OH component .pdf
                     OH component                                     .pdf                     OH component                                     .pdf
OH component .pdfaashwini4
 
moles of Na2CO3 = massmolecular mass = 0.50106 .pdf
                     moles of Na2CO3 = massmolecular mass = 0.50106 .pdf                     moles of Na2CO3 = massmolecular mass = 0.50106 .pdf
moles of Na2CO3 = massmolecular mass = 0.50106 .pdfaashwini4
 
Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf
                     Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf                     Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf
Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdfaashwini4
 
E.moles of solute per liter of of solution .pdf
                     E.moles of solute per liter of of solution       .pdf                     E.moles of solute per liter of of solution       .pdf
E.moles of solute per liter of of solution .pdfaashwini4
 
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdfaashwini4
 
We are generally omitt the concentration of the solids &the concentr.pdf
We are generally omitt the concentration of the solids &the concentr.pdfWe are generally omitt the concentration of the solids &the concentr.pdf
We are generally omitt the concentration of the solids &the concentr.pdfaashwini4
 
COVALENT ionic hydrogen bonding .pdf
                     COVALENT ionic hydrogen bonding                  .pdf                     COVALENT ionic hydrogen bonding                  .pdf
COVALENT ionic hydrogen bonding .pdfaashwini4
 
The reaction is maintained at a low temperature with slow addition o.pdf
The reaction is maintained at a low temperature with slow addition o.pdfThe reaction is maintained at a low temperature with slow addition o.pdf
The reaction is maintained at a low temperature with slow addition o.pdfaashwini4
 
There are two reasons.1. Presence of natural immunity2. Immunity.pdf
There are two reasons.1. Presence of natural immunity2. Immunity.pdfThere are two reasons.1. Presence of natural immunity2. Immunity.pdf
There are two reasons.1. Presence of natural immunity2. Immunity.pdfaashwini4
 
The difference between maximization of value of the corporation and .pdf
The difference between maximization of value of the corporation and .pdfThe difference between maximization of value of the corporation and .pdf
The difference between maximization of value of the corporation and .pdfaashwini4
 
The changes between the steady state.SolutionThe changes betwe.pdf
The changes between the steady state.SolutionThe changes betwe.pdfThe changes between the steady state.SolutionThe changes betwe.pdf
The changes between the steady state.SolutionThe changes betwe.pdfaashwini4
 
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdf
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdfSpore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdf
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdfaashwini4
 
b) the solutes volatilize at different rates in t.pdf
                     b) the solutes volatilize at different rates in t.pdf                     b) the solutes volatilize at different rates in t.pdf
b) the solutes volatilize at different rates in t.pdfaashwini4
 
Partnership Firms are taxed at multiple levels the Corporate Level.pdf
Partnership Firms are taxed at multiple levels  the Corporate Level.pdfPartnership Firms are taxed at multiple levels  the Corporate Level.pdf
Partnership Firms are taxed at multiple levels the Corporate Level.pdfaashwini4
 
Please give the problem detailsWhat are the solutions being mixed.pdf
Please give the problem detailsWhat are the solutions being mixed.pdfPlease give the problem detailsWhat are the solutions being mixed.pdf
Please give the problem detailsWhat are the solutions being mixed.pdfaashwini4
 
One case of paternity testing has been given in the figure. Four aut.pdf
One case of paternity testing has been given in the figure. Four aut.pdfOne case of paternity testing has been given in the figure. Four aut.pdf
One case of paternity testing has been given in the figure. Four aut.pdfaashwini4
 
Answer is D. I (1) will add at the carbonyl rath.pdf
                     Answer is D.  I (1) will add at the carbonyl rath.pdf                     Answer is D.  I (1) will add at the carbonyl rath.pdf
Answer is D. I (1) will add at the carbonyl rath.pdfaashwini4
 
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdf
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdfNasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdf
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdfaashwini4
 

Mais de aashwini4 (20)

1. True2. TrueSolution1. True2. True.pdf
1. True2. TrueSolution1. True2. True.pdf1. True2. TrueSolution1. True2. True.pdf
1. True2. TrueSolution1. True2. True.pdf
 
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf
1. Seminal vesicle2. Prostate gland3. bulbourethral gland4. Ep.pdf
 
OH component .pdf
                     OH component                                     .pdf                     OH component                                     .pdf
OH component .pdf
 
moles of Na2CO3 = massmolecular mass = 0.50106 .pdf
                     moles of Na2CO3 = massmolecular mass = 0.50106 .pdf                     moles of Na2CO3 = massmolecular mass = 0.50106 .pdf
moles of Na2CO3 = massmolecular mass = 0.50106 .pdf
 
Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf
                     Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf                     Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf
Hydronium ion = hydrogen ion [H3O+] = [H+] = 2.15.pdf
 
E.moles of solute per liter of of solution .pdf
                     E.moles of solute per liter of of solution       .pdf                     E.moles of solute per liter of of solution       .pdf
E.moles of solute per liter of of solution .pdf
 
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf
   This is mainly based on Hard - Soft acid base theory.Hard Acid .pdf
 
We are generally omitt the concentration of the solids &the concentr.pdf
We are generally omitt the concentration of the solids &the concentr.pdfWe are generally omitt the concentration of the solids &the concentr.pdf
We are generally omitt the concentration of the solids &the concentr.pdf
 
COVALENT ionic hydrogen bonding .pdf
                     COVALENT ionic hydrogen bonding                  .pdf                     COVALENT ionic hydrogen bonding                  .pdf
COVALENT ionic hydrogen bonding .pdf
 
The reaction is maintained at a low temperature with slow addition o.pdf
The reaction is maintained at a low temperature with slow addition o.pdfThe reaction is maintained at a low temperature with slow addition o.pdf
The reaction is maintained at a low temperature with slow addition o.pdf
 
There are two reasons.1. Presence of natural immunity2. Immunity.pdf
There are two reasons.1. Presence of natural immunity2. Immunity.pdfThere are two reasons.1. Presence of natural immunity2. Immunity.pdf
There are two reasons.1. Presence of natural immunity2. Immunity.pdf
 
The difference between maximization of value of the corporation and .pdf
The difference between maximization of value of the corporation and .pdfThe difference between maximization of value of the corporation and .pdf
The difference between maximization of value of the corporation and .pdf
 
The changes between the steady state.SolutionThe changes betwe.pdf
The changes between the steady state.SolutionThe changes betwe.pdfThe changes between the steady state.SolutionThe changes betwe.pdf
The changes between the steady state.SolutionThe changes betwe.pdf
 
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdf
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdfSpore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdf
Spore forming bacteria (prokaryotes) such as Bacillus anthracis can .pdf
 
b) the solutes volatilize at different rates in t.pdf
                     b) the solutes volatilize at different rates in t.pdf                     b) the solutes volatilize at different rates in t.pdf
b) the solutes volatilize at different rates in t.pdf
 
Partnership Firms are taxed at multiple levels the Corporate Level.pdf
Partnership Firms are taxed at multiple levels  the Corporate Level.pdfPartnership Firms are taxed at multiple levels  the Corporate Level.pdf
Partnership Firms are taxed at multiple levels the Corporate Level.pdf
 
Please give the problem detailsWhat are the solutions being mixed.pdf
Please give the problem detailsWhat are the solutions being mixed.pdfPlease give the problem detailsWhat are the solutions being mixed.pdf
Please give the problem detailsWhat are the solutions being mixed.pdf
 
One case of paternity testing has been given in the figure. Four aut.pdf
One case of paternity testing has been given in the figure. Four aut.pdfOne case of paternity testing has been given in the figure. Four aut.pdf
One case of paternity testing has been given in the figure. Four aut.pdf
 
Answer is D. I (1) will add at the carbonyl rath.pdf
                     Answer is D.  I (1) will add at the carbonyl rath.pdf                     Answer is D.  I (1) will add at the carbonyl rath.pdf
Answer is D. I (1) will add at the carbonyl rath.pdf
 
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdf
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdfNasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdf
Nasal cavity( nasal mucosa)-In humans, olfaction occurs when odora.pdf
 

Último

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 

Último (20)

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 

#include stdafx.h#include iostreamusing namespace std;cl.pdf

  • 1. #include "stdafx.h" #include using namespace std; class Inventory { private: int itemNumber; int quantity; double cost; double totalCost; public: Inventory() { itemNumber = 0; quantity = 0; cost = 0; totalCost = 0; } Inventory(int newItemNumber, int newQuantity, double newCost) { itemNumber = newItemNumber; quantity = newQuantity; cost = newCost; setTotalCost(quantity, cost); // this can be called as quantity and cost have now been initialized. } void setItemNumber(int) { itemNumber = itemNumber; } void setQuantity(int) { quantity = quantity; } void setCost(double)
  • 2. { cost = cost; } void setTotalCost(int, double) { totalCost = quantity * cost; } int getItemNumber() { return itemNumber; } int getQuantity() { return quantity; } double getCost() { return cost; } double getTotalCost() { return totalCost; } }; int main() { int itemNumber; int quantity; double cost; double totalCost; cout << "Enter the Item Number: "; cin >> itemNumber; while (itemNumber < 0) { cout << "Please enter a positive value for the Item Number: "; cin >> itemNumber;
  • 3. } cout << "Enter the Quantity of the item: "; cin >> quantity; while (quantity < 0) { cout << "Please enter a positive value for the Quantity of the item: "; cin >> quantity; } cout << "Enter the Cost of the item: "; cin >> cost; while (cost < 0) { cout << "Please enter a positive value for the Cost of the item: "; cin >> cost; } Inventory information(itemNumber, quantity, cost); totalCost = information.getTotalCost(); itemNumber = information.getItemNumber(); cost = information.getCost(); quantity = information.getQuantity(); cout << "The Item Number is: " << itemNumber << endl; cout << "The Quantity is: " << quantity << endl; cout << "The Cost is: " << cost << endl; cout << "The Total Cost is: " << totalCost << endl; return 0; } int _tmain(int argc, _TCHAR* argv[]) { return 0; } Solution #include "stdafx.h" #include
  • 4. using namespace std; class Inventory { private: int itemNumber; int quantity; double cost; double totalCost; public: Inventory() { itemNumber = 0; quantity = 0; cost = 0; totalCost = 0; } Inventory(int newItemNumber, int newQuantity, double newCost) { itemNumber = newItemNumber; quantity = newQuantity; cost = newCost; setTotalCost(quantity, cost); // this can be called as quantity and cost have now been initialized. } void setItemNumber(int) { itemNumber = itemNumber; } void setQuantity(int) { quantity = quantity; } void setCost(double) { cost = cost; }
  • 5. void setTotalCost(int, double) { totalCost = quantity * cost; } int getItemNumber() { return itemNumber; } int getQuantity() { return quantity; } double getCost() { return cost; } double getTotalCost() { return totalCost; } }; int main() { int itemNumber; int quantity; double cost; double totalCost; cout << "Enter the Item Number: "; cin >> itemNumber; while (itemNumber < 0) { cout << "Please enter a positive value for the Item Number: "; cin >> itemNumber; } cout << "Enter the Quantity of the item: "; cin >> quantity;
  • 6. while (quantity < 0) { cout << "Please enter a positive value for the Quantity of the item: "; cin >> quantity; } cout << "Enter the Cost of the item: "; cin >> cost; while (cost < 0) { cout << "Please enter a positive value for the Cost of the item: "; cin >> cost; } Inventory information(itemNumber, quantity, cost); totalCost = information.getTotalCost(); itemNumber = information.getItemNumber(); cost = information.getCost(); quantity = information.getQuantity(); cout << "The Item Number is: " << itemNumber << endl; cout << "The Quantity is: " << quantity << endl; cout << "The Cost is: " << cost << endl; cout << "The Total Cost is: " << totalCost << endl; return 0; } int _tmain(int argc, _TCHAR* argv[]) { return 0; }