Variables should be private and the class functions public

Assignment Help C/C++ Programming
Reference no: EM13165284

Define a class named Inventory. The class inventory should be written in a header file name Inventory.hpp. The class consists of following variables and functions--

Variables:

  • itemNumber-an integer variable that stores the item's number
  • quantity-an integer variable that holds the quantity of the item onhand
  • cost--a double that holds the wholesale per unit cost of the item
  • totalCost--a double thta holds the total inventory cost of the item (quantity*cost)

Functions:

  • a default constructor that sets all the member variables to zero
  • setItemNumber--accepts an integer argument that is copied to item-Number membe rvariable
  • setQuantity-accepts an integer argument that is copied to quantity member variable
  • setCost--accepts a double argument this is copied to cost member variable
  • setTotalCost-calculates the total inventory cost for the item (quantity*cost) and stores the result in totalCost
  • getItemNumber-returns the value in variable itemNumber
  • getQuantity--returns the value in variable quantity
  • getCost--returns the value in variable cost
  • getTotalCost--returns the value in variable totalCost.

All the class variables should be private and the class functions public. The class functions should be implemented in a file Inventory.cpp which should be linked with the inventory.hpp file.

After being done with the class declaration, create a file named Inventory-Main.cpp where you need to write your main function. You need to link both Inventory.cpp and Inventory.hpp to this file. In the main function, create an object of Type Inventory. Prompt the user to enter a value for the variables itemNumber, quantity, and cost. Set the variables and calculate the total cost. Display the values of all the variables for the object using the get functions in the following format:

"The item number 1 has 12 quantity each having a cost of 1.5 unit with the total cost being 18 units"

Reference no: EM13165284

Questions Cloud

Literature plan : You have just been hired to teach at a new preschool. You will be teaching a class of 3-5 year olds. Your task is to create a research-based “Literature Program” which will include developmentally appropriate approaches to teaching and learning. Your..
Develop an approach that will automatically integrate error : Develop an approach that will automatically integrate error messages and a user help facility. That is, the system would automatically recognize the error type and provide a help window with suggestions for correcting it. Perform a reasonably complet..
Study of prosocial behavior : By-stander behavior is an important topic within the study of prosocial (helping) behavior. Apply the well-known and respected by-stander research of Latane and Darley to this scenario:
F does not logically imply : Given R = (J,K,L ) and the set F of FDs J -> K and L -> K , show that F does NOT logically
Variables should be private and the class functions public : All the class variables should be private and the class functions public. The class functions should be implemented in a file Inventory.cpp which should be linked with the inventory.hpp file.
Encode or decode a color combination : In the early days of computer graphics, colors where represented as two numbers. The first number was the foreground color and the second was the background color. These two values, which ranged from 0 to 15 were stored within a single byte; the fore..
Offer activities to promote diversity : "Many organizations sponsor or offer activities to promote diversity.  What types of activities or trainings do organizations offer to ensure/promote a diverse company.
This program will simulate the game of hearts : This program will simulate the game of Hearts, which is a four-player trick-taking game using any ordinary deck of playing cards. Each player is dealt thirteen cards. Whoever is dealt the Two of Clubs must lead it to the first trick. Each person p..
Harassment prevention training : What are some of the reasons an organization should have harassment prevention training?  Even though our text focuses on sexual harassment, which groups of people, in addition to women, can be targets of harassment? "

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd