) Convert your structure into a class. For this exercise, you can leave the data as public (otherwise you would have to change the input and output functions). 2) Write a member function show_all that prints all the information for one record - name, cost, markup, and the three inventory numbers. 3) Add a user option S that lets the user see all the information for all the items in the inventory, using the show_all member function. Print a header so the user knows what each column means, and format the output to appear in columns. Hint: do a setwidth() before *each* cout. Pick widths that make sense for name, cost, markup, and the three inventory numbers.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

In C++
 
1) Convert your structure into a class. For this exercise, you can leave the data as public (otherwise you would have to change the input and output functions).
2) Write a member function show_all that prints all the information for one record - name, cost, markup, and the three inventory numbers.
3) Add a user option S that lets the user see all the information for all the items in the inventory, using the show_all member function.
Print a header so the user knows what each column means, and format the output to appear in columns.
Hint: do a setwidth() before *each* cout. Pick widths that make sense for name, cost, markup, and the three inventory numbers.

 

 

 

 

Previous Code:

#include <iostream>
using namespace std;
// function to prompt for the re-assigning 
int placement(int REDApplesCounter, int REDApplesCounterOnShelf, int AssortedBouquetsCounter, int CamembertCheeseCounter)
{
    // prompt for values
    cout<<"Enter the values in (P)lacement \n "<<endl;
    cout<<"Items Exists are: Red Delicious Apples, Assorted bouquets, Camembert Cheese"<<endl;
    cout<<"Enter the Red Apples Count: "; cin>>REDApplesCounter;
    cout<<"Enter the Red Apples on shelf Count: "; cin>>REDApplesCounterOnShelf;
    cout<<"Enter the Assorted bouquets Count: "; cin>>AssortedBouquetsCounter;
    cout<<"Enter the Camembert Cheese Count: "; cin>>CamembertCheeseCounter;
    return (REDApplesCounter, REDApplesCounterOnShelf, AssortedBouquetsCounter, CamembertCheeseCounter);
}

// main function
int main()
{
    // prompt for the values
    cout<<"Enter values "<<endl;
    int REDApplesCounter, REDApplesCounterOnShelf, AssortedBouquetsCounter, CamembertCheeseCounter;
    cout<<"Items Exists are: Red Delicious Apples, Assorted bouquets, Camembert Cheese"<<endl;
    cout<<"Enter the Red Apples Count: "; cin>>REDApplesCounter;
    cout<<"Enter the Red Apples on shelf Count: "; cin>>REDApplesCounterOnShelf;
    cout<<"Enter the Assorted bouquets Count: "; cin>>AssortedBouquetsCounter;
    cout<<"Enter the Camembert Cheese Count: "; cin>>CamembertCheeseCounter;
    
    
    cout<<"\n***********************************"<<endl;
    // prompt for choice
    char choice;
    cout<<"You have 3 \n(P)lacement\t(W)arning\te(X)it: ";cin>>choice;    
    
    // defining the switch cases
    switch(choice)
    {
        // for Placement
        case 'P': 
        {
            cout<<endl;
            cout<<"\nThe Red Apples Counts are: "<<REDApplesCounter;
            cout<<"\nThe Red Apples on shelf Counts are: "<<REDApplesCounterOnShelf;
            cout<<"\nThe Assorted bouquets Counts are: "<<AssortedBouquetsCounter;
            cout<<"\nThe Camembert Cheese Counts are: "<<CamembertCheeseCounter;
            cout<<"\nIf you want replacement then enter 'Y' otherwise 'N': ";
            bool ch;
            cin>>ch;
            // if user wants to again assign the values
            if(ch=='Y')
            {
                placement(REDApplesCounter, REDApplesCounterOnShelf, AssortedBouquetsCounter, CamembertCheeseCounter);
            }
            break;
        }
        
        // For warnings
        case 'W': 
        {
            cout<<endl;
            if(REDApplesCounter<10)
                cout<<"Warning: Red delicious Apples counter: "<<REDApplesCounter<<endl;
            if(REDApplesCounterOnShelf<10)
                cout<<"Warning: Red delicious Apples shelf: "<<REDApplesCounterOnShelf<<endl;
            if(AssortedBouquetsCounter<10)
                cout<<"Warning: Assorted bouquets warehouse: "<< AssortedBouquetsCounter<<endl;
            if(CamembertCheeseCounter<10)
                cout<<"Warning: Camembert Cheese warehouse: "<< CamembertCheeseCounter<<endl;
            break;
        }
        
        // Exit from the program
        case 'X':
            exit(0);        
            
        default: 
            cout<<"Wrong Input: "<<endl;
   }
   return 0;

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education