Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Student Performance Objectives: To review text file I/O To review modular design

ID: 3618157 • Letter: S

Question

Student Performance Objectives:


To review text file I/O

To review modular design

To review partially-filled arrays

To review call by reference

To review transaction processing

To employ an ordered linear search

To use strings

To use a union structure

To implement an array of hierarchical structures


Problem Scenario:


An art gallery, Free 2 Express, Inc., has requested a program to keep track of its paintings, prints, and photographs. It keeps at most 50 artworks in its inventory. The gallery owner has requested a program to help maintain the inventory record for the artworks.


Assignment Requirements:


1. The program must use text file input and file output using ifstream and ofstream. The files must be checked for successful open. If the files do not open, then exit the program. Close all files when appropriate.


INPUT FILE: ASCII text file, Gallery.data


Artwork

Identification Code

Integer max 5 digits

Height

Real max 999.99

Inches

Width

Real Max 999.99

Inches

Room

Placement

Code

Integer

Medium Code

Integer

Price

Real

Max 9999999.99

First Name

20 characters

max

No spaces

Last Name

20 characters

max

No Spaces


INPUT FILE: ASCII test file, Transactions.data,


Data records are in random order with spaces between fields. Each transaction record is in the following format:


Artwork

Identification

Transaction

Artwork

Identification Code

Integer max 5 digits

Height

Real max 999.99

Inches

Width

Real Max 999.99

Inches

Room

Placement

Code

Integer

Medium Code

Integer

Price

Real

Max 9999999.99



First Name

20 characters

max

No spaces

Last Name

20 characters

max

No Spaces



Explanation / Answer

please rate - thanks found the sample data files not done--looked up unions #include #include using namespace std; struct DIMENSIONS {double height; double width; }; struct ARTIST_NAME {char first[20]; char last[20]; }; struct GALLERY {int id; DIMENSIONS dim; int room; int medium; double price; ARTIST_NAME name; }; union NEWDAT {int room; double price; }; struct TRANSACTION {int id; char code; NEWDAT info; }; void fillgallery(GALLERY[],ifstream&,int&); voidgettransaction(TRANSACTION&,ifstream&,bool&,bool&); int main() { ifstream inGallery; ifstream inTrans; ofstream log; ofstream outGallery; GALLERY art[50]; TRANSACTION trans; int count; bool done,error; //Open Files & Check for a successful Open inGallery.open("Gallery.data"); if(inGallery.fail()) { cout