How would i set this up??

+2 Zayn Cho · November 4, 2014
Okay so how would i set this up?? I have no idea and can't really figure it out. 

Write a program that accepts as input a series of books (until the user enters a sentinel). For each book ask for: a code for the book, the single copy cost for the book, the current number of books on hand, the prospective class enrollment, and data that indicates if the book is required/optional, new/used (in the class) in past. As output, show all the input information in a nicely formatted screen along with how many books must be ordered (if any, note that only new books are ordered), the total cost of each order. 

i tried it but i think i had all of my functions wrong. Someone please help! lol

Post a Reply

Replies

Oldest  Newest  Rating
+1 Homer Simpson · November 20, 2014
I had a test today and this was pretty much the question lmfao!! I suggest you create a book class, you know with all that junk in there private variable, set/get, and what have you +  the display function taking in several arrays(one for each item that needs to be displayed).  In the main class create 1 instance of the book class and store each book and all that other junk(cost, isbn...etc) in their own respective array. Pass all the data into the display function and of course your display should be built in with a for loop that displays all that data! 
+1 Mayur Joshi · November 19, 2014
you can use file handling for this code as it will help you to store book database, also i am suggesting some points which will help you to develope this problem logic..
1. Using file handling will really make this code simple, specially for reading.
2.Use different variables for each data you want to operate and check individually, for ex. For purpose like optional or compulsory book use charecter variable 'o' or 'c' while writing, and use those in if else loop while reading to display in their category.
3.If you just want to format data in simple columns then use \t to represent, for this prblm, it is sufficient.
4.i think this is sufficient for you to develope your logic, it will be better if you try code by yourself and then post it for error correction.
5.and thats it, post code snap if you still stuck..
0 Ty Church · November 5, 2014
not 100% sure what your hoping to accomplish with this but by the sounds of it you'll have alot more luck "coding" this if u simply implement a database or just use a database

not sure if this was the answer u where looking for but since u said "how would i set this up" i figured you where more after a solution for where to begin then anything else
  • 1

C++

107,178 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator