English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

A wholesale book dealer neeeds a program to write invoices or book orders that he takes over the phone. Each order usually consist of multiple copies of several book titles. The program should ask the user if thee is an order to process. If the user responds yes, the program should then ask for the price of the first book in the order & the # of such books. The program should then display the cost of these books, including a 7.5% sales tax. Then it should ask for the price of the second book in the order & the # of such books, & display the cost of these books. The program should continue in this way, procesing the books in the first order. When there are no more books in the order, the program should display the total cost of the order. Then the program should ask if there is another order. If there is one, the program should process it as just described. If there are no more orders, the program should display the total # of orders processed, # of books sold, & total receipts.

2006-07-25 04:09:34 · 5 answers · asked by 812BOSS 1 in Computers & Internet Programming & Design

5 answers

console app i presume ??

ok first thing i would do is declare either a class or a struct to hold all the information regarding 1 order item like so ...

struct OrderItem
{
string bookName
int BookID
float UnitCost
int UnitCount
// ect ect ....
}

each order would contain one or many of these orderitem objects so we declare a collection to hold these items in (bit like a virtual basket) ..

HashTable CurrentOrder = new HasTable()

from here you can ask the user the questions ...

Console.Writeline("Add an item to the current order ?")
string Continue = Console.ReadLine();

While (Continue == "Yes")
{
// declare a new order item
OrderItem CurrentItem = new OrderItem()
// ask a question then save the answer
Console.WriteLine("Question")
CurrentItem.PartName = Console.Readline();
// fill each part
........................
// save this order item in the orderitems collection
CurrentOrder.Items.Add(CurrentItem)
// ask the user if they wish to carry on or finish this order
Console.Writeline("Wanna order something else ?")
Continue = Console.Readline()
} // the while test is done now before going back

// when we are done looping thru the above questions we will have a "CurrentOrder" collection of Current item objects with which we can pick out and drop the details of to the command prompts or even directly to a printer.

we just grab this collection ...

Some place we wanna stick part of an order = CurrentOrder.Items[item index][part index]

good luck with it ... lol i know what u mean with this whole homework thing !!! i have a few web sites i run and i dont know everything about the technologies in all of them and i dont have the code for each and every problem in my head but i get it too ... im not at school either ;)

good luck with your erm .. project :)

2006-07-25 04:44:29 · answer #1 · answered by Anonymous · 2 0

I'm only 18, so I'm not really at your level, but I agree. I didn't have any internet access until I moved to college. I would hear people say that they would use the internet for an essay on a book, or something like that. People are lazy, (not all of them) and I don't think it's fair that they would get the same grade as the kid that worked his butt off to do really well. I don't really know. Maybe you could have your students cite their work, or something. I can't think of anything else. I wish I could help more. But yeah, they will be running our country, and who knows, maybe they'll start doing their work. Or, remember the saying, "cheaters never prosper?" They'll continue to try to have someone else to the work for them, but it won't last long, when it comes down to it. The kid that worked his/her butt of for it will move out in front and be the prosperer. (is that spelt right?)

2016-03-27 06:18:40 · answer #2 · answered by ? 4 · 0 0

the following is how u can write that in c

#include
void main()
{ int n,p,i;
float x,t=0;
printf("if there's any order to process press 1\n");
scanf("%d",&i);
while(i==1)
{printf("enter the price of the book..");
scanf("%d",&p);
printf("enter the number of such books..");
scanf("%d",&n);
x=1.075*n*p;
t=t+x;
printf("the cost of the books of this kind is%f",x);
printf("if there's more order press 1 else press 2);
scanf("%d",i);
}
if(i==2) printf("the total cost of the purchase is %f",t);
}

2006-07-25 05:10:01 · answer #3 · answered by me 4 u 3 · 0 0

This sounds like you need an entire POS (point of sale) system. That is more than a few lines of psudo-code can help you with.

2006-07-25 04:22:00 · answer #4 · answered by John J 6 · 0 0

Have you searched google for programs that do this?

2006-07-25 04:17:19 · answer #5 · answered by rob 3 · 0 0

fedest.com, questions and answers