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 LogicPro Your Own Question

LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 12643
Experience:  Expert in Java C++ C C# VB Javascript Design SQL HTML
29751445
Type Your Homework Question Here...
LogicPro is online now
A new question is answered every 9 seconds

Please Help!! Ive been working on this programming assignment

This answer was rated:

Please Help!! Ive been working on this programming assignment for about 15 hours and its due in about 7 hours. I could really use you expertise!

I am working on a menu driven program with 4 user input options. I first built the program using case statements declared as chars 'A', 'B', etc. I now need to turn the case statements into their own functions which will be in a separate file called functions.h. I have typed the code to this point, but am just not able to get it to run correct. Here's the assignment:

Modification 1: You will convert each of your four menu options from Programming Assignment 1 into a functions. For example, case 1: instead of having the code in the case statement to print your products, you will call a global function that will print the products out. It will look like:

case 1:

printProducts(YOUR_PARAMETER_LIST);

break;

case 2:



These functions will be located in a header file called functions.h. Be sure to include this file at the top of file main.cpp.

Modification 2: Your product information will now be contained in a structure (struct). This structure will house all of the product’s variables (UPC, product name, etc). This structure definition will be in the functions.h header file. You will have all of the same variables as before.

Modification 3: In main, you will create an array of these structures that will hold all of your products. You will also have a constant variable called NUM_PRODUCTS that will hold the number of products that your array has. For this assignment that number is XXXXX but for Programming Assignment 3 that number will increase. You must create your program with scalability in mind, meaning that if I change the value of NUM_PRODUCTS, your code will still work without any further modifications.

Modification 4: When you create a product, you will set their information to the default values used in Programming Assignment 1. The UPC will now be randomly generated and cannot be changed by the user (for a default value it will be 0, but once the product is edited it will be randomly generated). In option 2 (edit), instead of asking the user for a UPC, you will generate a new one (each time a product is edited you will generate an new UPC). The format for the UPC is 1XXXXX [that is a one with five digits after it]; where the X’s are randomly generated. Hint: generate a random number between 1 and 99,999 then add that to 100,000 (think scale and shift like the dice). There will be no error checking for duplicates, if duplicates happen that is okay.

Modification 5: For each of your functions, you will pass as arguments to the function the array and the number of students in the array (remember that arrays are passed by reference).



I have my main.cpp, functions.h and functions.cpp written but not working correct. PLEASEEEEE HELLPPPP!!!!
Hi,
Welcome here.
My name is XXXXX XXXXX I will help you.

If you have any file(s), Zip all files; upload the zipped file to http://wikisend.com or http://ge.tt and post download link here. Formatting is messed up.


What is the deadline?
Customer: replied 3 years ago.

Hey logicpro,


 


I appreciate your help. Here is the zip file and the url. Cutting it a bit close, the deadline is 12:30pm today western time. Thank you so much, I've been at it for hours upon hours.


 


http://wikisend.com/download/953612/functions.zip


 


functions.zip

Customer: replied 3 years ago.

I apologize I meant mountain standard time

can you let me know the deadline in hours
Customer: replied 3 years ago.

Yes sir, the deadline is in 5 hours and thirty minutes. I'll also need a bit of time to write the algorithm, but I'm still working on it myself.

Can the deadline be extended to 15 hours
Customer: replied 3 years ago.

No, I wish it could but that is not possible. I'll send u the first program with the switch statement and hopefully that will help.


 


http://wikisend.com/download/567476/prog.cpp

ok. I will review and reply ASAP
Customer: replied 3 years ago.

Thank you

Welcome
I will provide you answer in 1 hour.
Customer: replied 3 years ago.

fantastic! thank you logicpro, I hope to be as savvy as you one day!

Welcome...
Download answer from here: Functions_CPP.zip

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions on original requirements at no extra charge and I’m always here to help.

Thank you for using this site!

Customer: replied 3 years ago.

Thank you logicpro, everything looks solid except when I compiled it returned



functions.cpp: In function ‘void EDIT_CHOICE(Product*, int)’:
functions.cpp:58: error: ‘srand’ was not declared in this scope
functions.cpp:59: error: ‘rand’ was not declared in this scope


 


 


I assume it just needs to be declared in that function as int srand?

I will check and reply
Customer: replied 3 years ago.

thank you sir


 

Which C++ compiler you are using?
Customer: replied 3 years ago.

winSCP

put
#include<cstdlib.h>
Customer: replied 3 years ago.

ok, what is that? I have not learned that library yet


 


after compiling it returned


 



main.cpp:4:21: error: cstdlib.h: No such file or directory
functions.cpp:5:21: error: cstdlib.h: No such file or directory
functions.cpp: In function ‘void EDIT_CHOICE(Product*, int)’:
functions.cpp:59: error: ‘srand’ was not declared in this scope
functions.cpp:60: error: ‘rand’ was not declared in this scope

Try after putting:
#include <cstdlib>

instead of
#include <cstdlib.h>
Customer: replied 3 years ago.

Sweet, compiled and executed perfectly. You are a life saver and a scholar. Thank you so much.


A few questions....


 


what is the #include cstdlib and the time.h and what are they used for?


 

THIS ANSWER IS LOCKED!

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


right, so what purpose do they serve? like cmath includes the math library function to solve equations and rand is the random number generator


 

Yes you are right :)
This header defines several general purpose functions, including dynamic memory management, random number generation, communication with the environment, integer arthmetics, searching, sorting and converting.
Customer: replied 3 years ago.

Ok, awesome. I can't thank you enough LogicPro! Hopefully not, but if I ever end up in a bind again I'll be in contact without a second thought. I'll also give my recommendation to anyone else in need. Thank you

Welcome :)

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions on original requirements at no extra charge and I’m always here to help.

Thank you for using this site!

Hi MAc,
Just following up with you to see how everything is going and if you have more questions for me.
You can ask me again using "For LogicPro only" at the start of your questions like you do to get instant answers.
It will ensure that question is for me.
Please bookmark my profile page:
http://www.justanswer.com/homework/expert-logicpro/
so you can come back and ask me a question anytime.
If you need any additional information on this answer, please don't hesitate to ask by clicking on 'Reply to Expert', and I will reply as soon as possible.
I hope you found the information in my answer helpful, and if so, please let me know, here. Thank you!
Thanks very much for using Just Answer!
Best wishes
LogicPro

Related Homework Questions