Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:29:06+00:00 2026-06-06T10:29:06+00:00

I am doing a homework assignment for my summer OO class and we need

  • 0

I am doing a homework assignment for my summer OO class and we need to write two classes. One is called Sale and the other is called Register. I’ve written my Sale class; here’s the .h file:

enum ItemType {BOOK, DVD, SOFTWARE, CREDIT};

class Sale
{
public:
    Sale();         // default constructor, 
            // sets numerical member data to 0

    void MakeSale(ItemType x, double amt);  

    ItemType Item();        // Returns the type of item in the sale
    double Price();     // Returns the price of the sale
    double Tax();       // Returns the amount of tax on the sale
    double Total();     // Returns the total price of the sale
    void Display();     // outputs sale info 

private:
    double price;   // price of item or amount of credit
    double tax;     // amount of sales tax 
    double total;   // final price once tax is added in.
    ItemType item;  // transaction type
};

For the Register class we need to include a dynamic array of Sale objects in our member data. We cannot use the vector class. How is this done?

Here’s my ‘Register’ ‘.h’

class Register{
public:

Register(int ident, int amount);
~Register();
int GetID(){return identification;}
int GetAmount(){return amountMoney;}
void RingUpSale(ItemType item, int basePrice);
void ShowLast();
void ShowAll();
void Cancel();
int SalesTax(int n);

private:

int identification;
int amountMoney;

};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:29:07+00:00Added an answer on June 6, 2026 at 10:29 am

    All you need in the Register class is an array of Sale objects, and a item counter to remember how many sales were made.

    For example if there are 10 items in the register you will need to do this:

    int saleCount = 10;
    Sale[] saleList = new Sale[saleCount];
    

    To make the array dynamic you will need to create a new Sale array every time the sale count is incremented, and copy all the items in saleList into a new sale list. Finally add the new Sale at the end.

    saleCount++;
    Sale[] newSaleList = new Sale[saleCount];
    //copy all the old sale items into the new list.
    for (int i=0; i<saleList.length; i++){
      newSaleList[i] = saleList[i];
    }
    //add the new sale at the end of the new array
    newSaleList[saleCount-1] = newSale;
    //set the saleList array as the new array
    saleList = newSaleList;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a homework assignment for my summer OO class and we need
I am doing a homework assignment that deals with classes and objects. In it,
I'm doing a homework assignment in which I need to print out to the
I've got a homework assignment where I have a base class Package, and two
I'm doing a homework assignment for my course in C (first programming course). Part
Doing some homework here (second assignment, still extremely green...). The object is to read
I'm doing a homework in MARS simulator (Assembly) and I'm stuck on one part.
I am doing a little homework assignment in which we are making a very
For a homework assignment, I have to write a MySQL query to calculate the
So I am doing homework and I am stuck on one spot. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.