Lab1 C Warmup with Shopping for food.


51 views
Uploaded on:
Description
Lab1 C Warmup with Grocery Shopping Cop 4331 and EEL4884 © Dr. David A. Laborer School of EE and Computer Science University of Central Florida 20 January 2009 Problem Statement
Transcripts
Slide 1

Lab1 C++ Warmup with Grocery Shopping Cop 4331 and EEL4884 © Dr. David A. Worker School of EE and Computer Science University of Central Florida 20 January 2009

Slide 2

Problem Statement You have quite recently been acquainted with the OO Data Input/Output organization and outline convention. We have contemplated the configuration of the Grocery and Produce classes as case of how to actualize these information and yield positions for occasions of class sorts. The motivation behind this lab task is develop your comprehension of these outline and usage standards and additionally to give you some work on utilizing the elements of C++ required by this task. You will be given the accompanying system units to reuse, IOMgmt might be utilized without change: IOMgmt, Grocery and Produce. You will be solicited to compose missing techniques from classes Grocery and Produce, and to compose the application fundamental() that fulfills the necessities of this task.. (c) Dr. David A. Worker

Slide 3

Requirements The application might read all information from an outer ASCII record stream. The application should keep in touch with all yield information to an outside ASCII record stream. The capacities of IOMgmt::InMgr and IOMgmt::OutMgr should be utilized by the application to characterize and open the information and yield streams. The application might read the accompanying data from the information stream: (1) The quantity of Grocery occasions to acknowledge (nGrocery) and the quantity of Produce cases to acknowledge (nProduce). These qualities might be determined in any request on maybe a couple lines with the accompanying configuration: nGrocery: <value> nProduce: <value> Any substantial whole number strict can be indicated by <value>. The distinguishing name and relating esteem should be delimited by white space. (2) An arrangement of zero or more examples of classes Grocery and Produce, determined in the OO Data position for these classes, in any request. (c) Dr. David A. Worker

Slide 4

Requirements The application should prepare the info record by: (1) perusing the estimations of (nGrocery) and (nProduce) and powerfully allotting a variety of Grocery cases (if nGrocery is certain), and progressively designating a variety of Produce occurrences (if nProduce is sure). The estimations of these parameters might be composed to the yield stream in the same arrangement utilized for information. (2) Sequentially perusing occasions of Grocery and Produce as they show up in the information stream. Examples of class Grocery will be spared in the capacity exhibit, in the request experienced in the information stream, gave, obviously, limit is accessible to do as such. Any Grocery occurrences for which space in the dynamic exhibit is not accessible, should be "rejected"; that is, composed promptly to the yield stream with a GROCERY OVERFLOW message. A practically equivalent to necessity applies to occurrences of class Produce. (3) Images of Grocery and Produce might be extricated from the info stream utilizing the extraction administrator characterized as a part of class Grocery. (4) The application might be intended to recognize mistakes in the information particular organization. Assuming either (nGrocery) or (nProduce) are not determined, the system might compose a fitting mistake message to the yield stream and end. In the event that a TokenError exemption is tossed amid the extraction of a Grocery or Produce occurrence, then the application should end subsequent to yielding the accompanying data: (a) the special case message and birthplace, (b) the acknowledged occasions of Grocery to that point, (c) the acknowledged cases of Produce to that point. (5) After the information stream has been totally handled, the application might yield (a) the acknowledged occurrences of Grocery and their check; (b) the acknowledged occasions of Produce and their tally; (c) Dr. David A. Worker

Slide 5

Sample Input & Output Grocery.input nGrocery: 5 nProduce: 2 Produce{ name: P3 markup: 2.0 cost: 350 weight: 3.5 }Produce Grocery{ name: G2 markup: 2.25 cost: 400 }Grocery Grocery{ name: G1 markup: 3.25 cost: 500 }Grocery Produce{ name: P1 markup: 2.50 cost: 300 weight: 1.75 }Produce Produce{ name: P2 markup: 1.50 cost: 200 weight: 6.0 }Produce Grocery{ name: G4 markup: 3.2 cost: 600 }Grocery Grocery{ name: G3 markup: 3.0 cost: 550 }Grocery Grocery.output nGrocery: 5 nProduce: 2 =============================== START INPUT ================== Produce thing OVERFLOW. The accompanying thing is rejected: Produce{ name: P2 markup: 1.5 cost: 200 weight: 6 }Produce =============================== END INPUT ==================== Grocery{ name: G2 markup: 2.25 cost: 400 }Grocery Grocery{ name: G1 markup: 3.25 cost: 500 }Grocery Grocery{ name: G4 markup: 3.2 cost: 600 }Grocery Grocery{ name: G3 markup: 3 cost: 550 }Grocery 4 Grocery Items Accepted. Produce{ name: P3 markup: 2 cost: 350 weight: 3.5 }Produce Produce{ name: P1 markup: 2.5 cost: 300 weight: 1.75 }Produce 2 Produce Items Accepted. (c) Dr. David A. Worker

Slide 6

Requirements The engineer might compose the accompanying units in C++: (a) GroceryApp (fundamental()) (b) Grocery::Get() as per the OO information outline convention; infringement to organization determination for Grocery occasions should bring about tossing a TokenError exemption. (c) Produce::Get() as per the OO information plan convention; infringement to organization determination for Grocery examples might bring about tossing a TokenError exemption. No IO elements of the C dialect are allowed. The C++ extraction and insertion administrators might be utilized solely to read or composing from the info and yield document streams, individually. InMgr::setFilePos() and InMgr::resetFilePos() should be utilized only to deal with the info stream for distinguishing OO occurrences and after that understanding them. The element clusters might be deallocated by the application toward the end of preparing. InMgr and OutMgr occurrences should be legitimately shut by the application toward the end of handling. (c) Dr. David A. Laborer

Slide 7

IOMgmt Architectural Design Gen/Spec AppError Composition Aggregation (compartment) reliance IOError TokenError affiliation (principle) OutMgr InMgr GroceryApp Writes to Grocery Produce nGrocery nProduce 1 fout: ofstream 1 blade: ifstream (c) Dr. David A. Laborer

Slide 8

Lab1 Deliverables All and just the source documents utilized by the engineer as a part of finishing this task. A UNIX makefile for this application. This makefile might keep running without change on olympus.eecs.ucf.edu to assemble, connection and produce an executable named: GroceryApp . All deliverables might be submitted by means of Webcourses as a solitary (.compress) record taking after the naming tradition: Lab1 - Lastname - MmmDD .compress (where MmmDD is the month and day of accommodation.) (c) Dr. David A. Worker

Recommended
View more...