How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask R.R. Jha Your Own Question

R.R. Jha
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
20870358
Type Your Homework Question Here...
R.R. Jha is online now
A new question is answered every 9 seconds

C++ question: a mail order house sells five different products

Resolved Question:

C++ question: a mail order house sells five different products whose retail prices are:
a. Product 1 $2.98
b. Product 2 $4.50
c. Product 3 $9.98
d. Product 4 $4.49
e. Product 5 $6.87

deliverables: complete hierarchy chart in visio, problem statement in word. Test file is named project_2.dat and contains data as follows:

1 5
3 7
2 10
4 15
5 6
1 3
2 6
1 7
3 4
5 8
1 6

where, the left-most number represents the product number and the right-most number is XXXXX sold.

The prices should be stored in a one-dimension array and indexed by the product number which will range from 1 - 5 (0 - 4).

Write a program that accepts the name of the file from the command-line and reads from that data file.

Program needs to use a struct (abstract data type) to represent a shopping cart and it should be implemented using 3 files: main.cpp, shoppingCart.h and shoppingCart.cpp

The main program contains a loop that:

reads the product sold and quantity sold from the dat file, until the end of the file is reached.
Calls the addItem function with uses the product ID and quantity to look up and calculate the combined price and stores the calculated total price and quantity in the struct. Be sure to maintain the total_trans_count.
Calls the showTotal() function to print the following information in this order:

Total dollar value of all items sold (sum of totalPrice)

Quantity and dollar value of each product sold
Submitted: 3 years ago.
Category: Homework
Expert:  R.R. Jha replied 3 years ago.
Hi,
Welcome!

I'd be glad to help with this. Could you please send original requirements document for this question? Also mention the deadline.


Thanks
Customer: replied 3 years ago.
Sure. The deadline is basically tomorrow morning Eastern Std. Time (U.S.). The original document is (don't see where to attach here):

Project deliverables are:
1. A 7-zip file named yourlastname_p2 submitted
This file must contain the following
a. Entire C++. Directory tree for the program named project_2
The working program should include the following:
• Code comments where appropriate
2. A concise problem definition statement defining the outputs, inputs, and
process. For example:
Calculate the distance in miles between an observer and a
thunderstorm. The algorithm n/5 will be used to calculate the distance.
Where n = time in seconds between the lightening flash and the
thunder.
3. Completed hierarchy chart – Handed in separately – Use of Visio is
strongly encouraged.
4. The calculated retail value of all the sales contained in the test file.
Note the test file must be saved in the project_2\project_2 folder.
A mail order house sells five different products whose retail prices are:
a. Product 1 $2.98
b. Product 2 $ 4.50
c. Product 3 $ 9.98
d. Product 4 $ 4.49
e. Product 5 $ 6.87
These prices should be stored in a 1 dimension array and indexed by the product
number which will only range from 1 – 5.
Write a program that accepts the name of the file from the command-line and
reads from a data from that file. The file contains pairs of numbers as follows:
Product number
Quantity sold
V1.5 4/4/2013
Additional requirements:
Your program should use a struct (an abstract data type) to represent a shopping
cart and it should be implemented using 3 files: main.cpp, shoppingcart.h, and
shoppingcart.cpp
void additem(int quantity, int productID);
void showtotal();
struct shoppingCart
{
Double m_totalPrice; // The combined price of all items in the
Int item_qty[4] // Cart
Int m_total_trans_count // count of transactions processed
};

o The main program contains a loop that:
 Reads the product sold and quantity sold from the data file,
until the end of the file is reached.
 Calls the addItem funtion which uses the productID and
quantity to lookup and calculate the combined price and
stores the calculated total price and quantity in the struct.
Besure to maintain the total_trans_count.
 Calls the showTotal() function to print the following
information in the order shown below.
 Total dollar value of all items sold (sum of m_totalPrice)
 Quantity and dollar value of each product sold

Here's the entries for the file called project_2.dat:

1 5
3 7
2 10
4 15
5 6
1 3
2 6
1 7
3 4
5 8
1 6

I'll pay more if needed. Just let me know. I want to learn from this, too. Thanks!
Expert:  R.R. Jha replied 3 years ago.
You may upload the file at wikisend.com and post download link here.
As I work through this, I'll let you know if price needs to change.

Thanks
Customer: replied 3 years ago.
Thanks! Here you go:
http://wikisend.com/download/934394/project_2.pdf
http://wikisend.com/download/412408/project_2.dat
Expert:  R.R. Jha replied 3 years ago.
Received them.
Customer: replied 3 years ago.
TY for acknowledging receipt of the files.
Expert:  R.R. Jha replied 3 years ago.
You're welcome!

I'm working through this. The program, along with problem statement and hierarchy chart, is rather time taking. Let me know if you could add $30 as bonus. Option to add bonus would be available once you've rated the answer. I'll try to finish it and send asap.


Thanks
Customer: replied 3 years ago.
Absolutely. And thank you.
Expert:  R.R. Jha replied 3 years ago.
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
R.R. Jha and 4 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

RRJha: New C++ question: Write a function to output an entire array that conforms with the following prototype: void printEntries(int *pstart, int *pEnd);

 

Where: pStart – is a pointer to the first element of the array.

Pend – is a pointer to the last element of the array.

 

Your implementation of this function should NOT:

• Use any local variables

• Use array subscript notation to print the array (i.e. do not use the form pStart)

Call this function using the sizeof() operator to determine pEnd on two different arrays:

• 10 integer array

• 15 integer array

Customer: replied 3 years ago.
Please disregard. Thank you, though.

Related Homework Questions