Question

write a C++ program that reads the gallery's inventory from a file called ArtFile.txt or ArtFile.csv...

write a C++ program that reads the gallery's inventory from a file called ArtFile.txt or ArtFile.csv into the array of artist struct. Then allow the user to look up the art by specifying any field in the record. [The file extracted a selected number of art works from the National Gallery of Art: NGS.gov.]

The user should be able to specify a field, and a value for that field, and the program then returns all artworks that match those criteria. For example, the user may specify Artist and Steichen, and the program will output all of the information concerning every work in the gallery by that artist.

The key elements reviewed in this assignment are: (1) defining the appropriate structs, (2) defining the arrays for the structs, (3) opening and reading from a file that populates the declared struct, (4) implementing all the exercises in 7 of the Programming Warm-Up Exercises.

Programming Warm-Up Exercises

7. A gallery needs to keep track of its paintings and photographs. It keeps some art works on its walls. Each one is described by the following information:

A struct for artist
Artist Last Name (string)
Artist First Name (string)
An internal struct for work of art with
Medium (string) [black chalk, engraving, etching, charcoal, gelatin silver print, gouache, graphite, iris print, lithograph, oil, paper collage, pen and brown ink, photogravure, platinum print, red chalk, tempera and ink]
Title (string)
Width (double)
Price (double)
Room (string) [where it is hung :main, green, blue, north, south, entry, balcony]
Define a struct for artist and an internal struct for work of art hanging in the museum. The artist struct is an array. The several works of art within each artist struct is an additional array. Lastly, declare the artist struct array with the name currentList and an int variable numPieces. The numPieces variable contains the number of pieces represented in the array. [There should be 34 items.]

8. Write expressions that retrieve the following values from the array declared in Exercise 7.

The 7th work of art.
The title of the 12th work of art.
The width of the 25th work of art.
The room for the 34th work of art.
The first letter of the artist's name for the 18th work of art.
9. Write a �for loop� that prints a list of the artist, title, and price for every artwork in the currentList array defined in Exercise 7.

10. Write a code segment that sums the prices of the artworks in the gallery described in Exercise 7.

11. Write a code segment that outputs the titles of the artworks in the blue room of the gallery described in Exercise 7.

12. Write a code segment that sums the prices of the oil paintings in the gallery described in Exercise 7 that are larger than 300 square inches in size.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer /xxxxx***** CPP INVENTORY //HEADER FILES INCLUSION #include <iostream> #include <string> # include <conio. h> #includecout<<Artist Name:<<currentListi]. lastName<endl: cout<<Artist First Name : <<current List [i] . firstNameくくendl ; cout<

Add a comment
Know the answer?
Add Answer to:
write a C++ program that reads the gallery's inventory from a file called ArtFile.txt or ArtFile.csv...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is for C++ Write a program that reads in a sequence of characters entered by...

    This is for C++ Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along with the number of times it occured. All non-alphabetic characters must...

  • Use basic C++ 3. A text file, superstars.txt, contains statistics on cricket players. For each player,...

    Use basic C++ 3. A text file, superstars.txt, contains statistics on cricket players. For each player, the file contains the player's first name, last name, number of matches played, total number of runs scored, number of times the player scored 100 runs in a match, and the number of wickets taken. The last row of data in the file contains the word "END" only. Some rows are shown below 30 11867 164 Chanderpaul Shivnarine 34 11912 130 Lara Brian 73...

  • c++ The program will be recieved from the user as input name of an input file...

    c++ The program will be recieved from the user as input name of an input file and and output.file. then read in a list of name, id# and score from input file (inputFile.txt) and initilized the array of struct. find the student with the higher score and output the students info in the output file obtain the sum of all score and output the resurl in output file. prompt the user for a name to search for, when it find...

  • C++ 3. Write a program that reads integers from a file, sums the values and calculates...

    C++ 3. Write a program that reads integers from a file, sums the values and calculates the average. a. Write a value-returning function that opens an input file named in File txt. You may "hard-code" the file name, i.e., you do not need to ask the user for the file name. The function should check the file state of the input file and return a value indicating success or failure. Main should check the returned value and if the file...

  • C++ program that reads students' names followed by their test scores (5 scores) from the given...

    C++ program that reads students' names followed by their test scores (5 scores) from the given input file, students.txt. The program should output to a file, output.txt, each student's first name, last name, followed by the test scores and the relevant grade. All data should be separated by a single space. Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, an array of testScores of type int...

  • C++ Write a program that reads students’ names followed by their test scores from the given...

    C++ Write a program that reads students’ names followed by their test scores from the given input file. The program should output to a file, output.txt, each student’s name followed by the test scores and the relevant grade. Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, testScore of type int and grade of type char. Suppose that the class has 20 students. Use an array of...

  • Write a program that reads a string from the keyboard and tests whether it contains a...

    Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • Write a program (C++) that shows Game sales. The program should use a structure to store...

    Write a program (C++) that shows Game sales. The program should use a structure to store the following data about the Game sale: Game company Type of Game (Action, Adventure, Sports etc.) Year of Sale Sale Price The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program...

  • Program: Playlist (C++) I'm having difficulty figuring out how to get the header file to work....

    Program: Playlist (C++) I'm having difficulty figuring out how to get the header file to work. You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. Playlist.h - Class declaration Playlist.cpp - Class definition main.cpp - main() function Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. Default constructor (1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT