Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this final section of the final you will find two C++ Class problems below. You are to select any one and provide an algorithmic

In this final section of the final you will find two C++ Class problems below. You are to select any one and provide an algorithmic solution to the programming challenge. Use a standard C++ compiler and write the necessary C++ source code paying careful attention to the program specifications as outlined for each program. I suggest writing your source code file with the class specification (include member implementation as inline functions) and client test code in a single file. Multiple class related files are not needed.

RetailItem Class Program:

Write a class named RetailItem that holds data about an item in a retail store. The class should have the following member variables.

description. A string that holds a brief description of the item.

unitsOnHand. An int that holds the number of units currently in inventory.

sizes. A char that holds the following sizes: S for small, M for medium, L for large, Y for youth and I for infant.

price. A double that holds the items retail price.

Write a constructor that accepts arguments for each member variable, appropriate transformer functions that store values in these member variables, and observer functions that return the values in these member variables. In order to receive a grade the program must compile and must include a RetailItem class declaration, RetailItem class objects and a few operations to test drive the class member function implementation.

Since this program is not intended to be a multiple file project, the member functions should be written as inline functions within the class specification block. Once you have written the class specification write the necessary code in int main( ) that creates three RetailItem objects, stores the following data in them and displays the details contained in each RetailItem object as shown in the sample display format below.

Description Units on Hand Price_ Size

Item#1 Jacket 12 $9.95 Y

Item#2 Designer Jeans 40 $34.95 M

Item#3 Shirt 20 $24.94 S

___________________________________________________

Input Validation: include validation where appropriate.

________________________________________________________________________________________________________________________ //RetailItem.cpp sample partial code to test RetailItem class, use as needed // Your name and last four digits of your student ID #include #include

using namespace std;

//RetailItem class specification section including all class member functions defined as inline class RetailItem { private: //data members here

public: //Constructor definition here //transformer and observer type of inline function definitions here

};

//***********client code testing RetailItem class*************

int main()

{

//create three RetailItem objects //code to define instances of the RetailItem class object parameterized constructor called

// code to display each item's data. //call the class observer functions

for (int counter=0; counter<4;counter++){ //if needed

. __________________________________________________________________________________________________

OR

TestScores Class Program

Design a TestScores class that has member variables to hold thirty test scores. The class should have a constructor, observer (aka. accessor), and transformer (aka. mutator) functions for the test score fields, and appropriate member functions that return both the highest as well as the average score .

Since this program is not intended to be a multiple file project, the functions should be written as inline functions within the class specification block. Once you have written the class specification write the necessary code in int main( ) that should ask the user to enter thirty test scores, which are stored in the TestScores object. Then the program should display the highest score followed by the average of the scores, as reported by the TestScores object. If needed you may declare and define an array inside your class specification. In order to receive a grade the program must include a TestScores class and must compile. Hint: You may consider including a single dimensional scores array as a data member in your TestScores class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

Explain budgetary reporting requirements.

Answered: 1 week ago