can someone solve this?

Assume that a sales man in stationery asks you to write a program to help in managing the books information. Each book has a title, author name, edition no, publisher, ISBN, price. ISBN number is a unique number for each book.
To represent and manage books information in your program, use parallel arrays; array for each piece of information. use a continue menu to enable the user to do the following:
• Add new book to the list. Ask the use to enter the book information. Check if the ISBN is for one of the books in the list display an error message; otherwise add it to the list. Make sure that the list is not full.
• Update book information; prompt the user to enter the book ISBN , then ask the user to enter the other details. Display appropriate message if the ISBN is not valid
• Delete a book; ask the user to enter the ISBN. If the ISBN is valid, display the book information and then ask the user to confirm the deletion process.
• Display a list of all books. Books information should be organized in a table. use formatting manipulators.
• Display the titles of the books which have number of copies less than five.
• Sort books information by title.
• Sort books information by publisher.
• check whether a book is available or not, by ask the user to enter the book title and if it available display book information.

Sure, we can solve it!

...wait, how would the information that someone can solve this problem help you though?

-Albatross
If a SALESMAN approached me and asked for this my reactions would be slightley more vulger then the following:

- "Get back in your cubical before I get the newspaper again! I swear I'll use the Sunday edition if you ever try to tell me how to do my job again!"

- "Yeah tell you what, if you can spell ISBN I'll continue to listen to the rest of this prattle. Heck I'll eat my socks if you can tell me what it stands for with out running to a search engine."

- "My program won't delete anything because you are the last person that should be handeling inventory. (This goes for pretty much all salespeople.)"

- "Do you know what formatting manipulators are? Do you even know what a table is? I'll give you a hint it isn't what your third wife was dancing on when you met."

- "Why only five? Is this as high as they taught you to count at that community college?"

- "Do you mean at the same time? Or one immediatly after the other? Are you even the one I should be talking to? Isn't it more productive for me to be shouting nonsense out my window at people walking by?"

At this point I would walk away because interactions regarding any matter with a sales persons will inevitably lead to confrontations with HR and or police. So your assignment is void as this situation would never happen in real life. Glad I could help :D!

EDIT: Yes my response was a poor attempt at humor but if there is any truth to it remember my third bullet, Salemen should NEVER be given direct control over inventory. These people are the main reason that private members exist in C++. Do NOT allow them access to inventory levels EVER!
Last edited on
I can't solve this program and i have to submit tomorrow.....
Well now not commenting on our sense of humor, no matter how dry it may be, is no way to win us over. You could try appealing to our good nature but that just tells us that you haven't spent too much time around programmers.

EDIT: For productive help, post what you have so far along with the errors or inconsistancies you are seeing and we will help you. For more poor satire keep doing what you are doing.
Last edited on
I just want someone to help me to understand this program
sorry. I thought you can help me to solve it step by step ........*_*
Samoi, I don't think that anybody here is being rude to you but that application sounds like it would be quite a bit of work to create. Let alone to deploy in the business world bug-free. I don't know nearly enough about coding to even point you in the right direction but I would look up some Youtube videos on database tutorials to get a start with. But I just can't imagine starting an application like this within a day... If this is how your company treats you on a regular basis that is very unfair and you should look for employment elsewhere. I also agree with the notion that a salesman shouldn't be making requests of this nature. If not for anything else that they don't normally and shouldn't have that type of authority over fellow employees...
We can help you break it down. But from your title and initial post it sounds like you want us to write it for you.
I know you have a teacher for this. Try ask first about any idea then try to work on your own, if you have problem regarding you code post it here and we are here to help you. I know you can do it. There is saying in programing "divide and conquer" try to analyze one by one.


http://codewall.blogspot.com
Last edited on
Use one –dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receive $200 plus 9 percent of $5000, or total of $650. Write a program (using an array of counters)that determines how many of the salespeople earned salaries in each of the following ranges(assume that each salesperson's salary is truncated to an integer amount):
a) $200-$299
b) $300-$399
c) $400-$499
d) $500-$599
e) $600-$699
f) $700-$799
g) $800-$899
h) $900-$999
i) $1000 and over
is my code for this program right?
# include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main()
{
double gross;
double pay;
int frequency[9]={0};
int y=0; int b=0;int r=0;int e=0;int p=0;int u=0;int w=0;int l=0;int d=0;
cout<<"Enter salesperson's gross sales in dollars (-1 to end): "<<endl;
cin>>gross;

while ( gross!=-1)
{
pay=200+.09*gross;
if(gross>=200&&gross<=299)

frequency[0]=y++;
else
if(gross>=300&&gross<=399)

frequency[1]=b++;
else
if(gross>=400&&gross<=499)

frequency[2]=r++;
else
if(gross>=500&&gross<=599)

frequency[3]=e++;
else
if(gross>=600&&gross<=699)

frequency[4]=p++;
else
if(gross>=700&&gross<=799)

frequency[5]=u++;
else
if(gross>=800&&gross<=899)

frequency[6]=w++;
else
if(gross>=900&&gross<=999)

frequency[7]=l++;
else
if(gross>=1000)

frequency[8]=d++;


cout<<"Enter salesperson's gross sales in dollars (-1 to end): "<<endl;
cin>>gross;

}

cout<<"range:"<<" frequency "<<endl;
cout<< "$200-$299 "<<frequency[0]<<endl;
cout<<"$300-$399 "<<frequency[1]<<endl;
cout<<"$400-$499 "<<frequency[2]<<endl;
cout<<"$500-$599 "<<frequency[3]<<endl;
cout<<"$600-$699 "<<frequency[4]<<endl;
cout<<"$700-$799 "<<frequency[5]<<endl;
cout<<"$800-$899 "<<frequency[6]<<endl;
cout<<"$900-$999 "<<frequency[7]<<endl;
cout<<"$1000 and over "<<frequency[8]<<endl;


return 0;
}

[code] "Your code goes here" [/code]
frequency[0]=y++; That will not get the desired behaviour. First you assign, then increment.
What is the point of the array if you are going to have that others 9 variables with the same information ?
frequency[0]++;

Try to think of a way for transforming the values with arithmetic operations instead of if else
I assign it before
int y=0; int b=0;int r=0;int e=0;int p=0;int u=0;int w=0;int l=0;int d=0;
your if statements should refer to pay, not gross.
EDIT: besides, what ne555 meant is that your while loop can instead be:
1
2
3
4
5
6
7
8
9
10
while ( gross!=-1)
{
pay=200+.09*gross;
if(pay<1000) 
	frequency[(int)pay/100-2]++;
else
	frequency[8]++;
cout<<"Enter salesperson's gross sales in dollars (-1 to end): "<<endl;
cin>>gross;
}

post if you don't understand what's going on in line 5.
Last edited on
1
2
3
int a,b=0;
a=b++;
cout << a << ' ' << b;

Output
0 1
Topic archived. No new replies allowed.