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: 5420
Experience:  B.Tech
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: 1 year ago.
Category: Homework
Expert:  R.R. Jha replied 1 year 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 1 year 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 1 year 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 1 year 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 1 year ago.
Received them.
Customer: replied 1 year ago.
TY for acknowledging receipt of the files.
Expert:  R.R. Jha replied 1 year 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 1 year ago.
Absolutely. And thank you.
Expert:  R.R. Jha replied 1 year 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, Tutor
Category: Homework
Satisfied Customers: 5420
Experience: B.Tech
R.R. Jha and 7 other Homework Specialists are ready to help you
Customer: replied 1 year 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 1 year ago.
Please disregard. Thank you, though.

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Last | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3121
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3035
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/lanis/2009-4-1_233717_phput9xef_c1pm.jpg Lani S.'s Avatar

    Lani S.

    Tutor

    Satisfied Customers:

    2457
    Registered Nurse, Internet Researcher, Private Tutor
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2341
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1975
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1873
    Bachelors Degree and CPA with Accounting work experience