Question

In: Computer Science

Create a C++ program to simulate an art gallery: 4 classes: Gallery class Has three vectors...

Create a C++ program to simulate an art gallery:

  • 4 classes:
    • Gallery class
      • Has three vectors of type Painting which represent three categories of paintings (abstract, impressionism, pointillism)
      • Has a function that reads in paintings from a file and stores each painting in the correct vector
      • Read in paintings from file (will have multiple paintings)

Title of painting

Artists first name

Artists last name

Address street number

Address street name

Address city

Address state

Address zip

Artists website

Category

Number

    • Need a function that creates an instance of the painting and passes it to a function to determines which vector the painting should be added to and then add it
  • Painting class
    • Has an instance of type Artist that will represent the artist of the painting
    • Each painting also has a title, a number, and a category
    • Need a function to print the specific information about each painting to a file
      • Need a sort function to sort the paintings in alphabetical order by the artists last name and a function that returns true or false based on if paiting1’s artist’s last name is less than paiting2’s artist’s last name
      • Print the data from each painting by category
    • It should also call the print function from Artist to print the artist information
  • Artist class
    • Artist has an instance of Address
    • Artist needs 2 data members for first and for the last name
    • Need a function that prints the persons last and first name and the address using the Address class’s print function
  • Address class
    • Has physical address and web address of artist
    • Write a function that prints the address

Should print to a file all of the paintings by category and in alphabetical order based on the artist's last name.

This is an example txt file but the program will be tested with multiple files with different numbers of paintings:

Full Fathom Five

Jackson

Pollock

16

Woodbury

Springs

NY

11937

www.jacksonpollock.com

Abstract

978-3-16-148410-0

Impression, Sunrise

Claude

Monet

361

Sunflower

Giverny

France

27620

www.claudemonet.com

Impressionism

968-3-16-158420-0

A Sunday Afternoon on the Island of La Grande Jatte

Georges

Seurat

89

Longview

Paris

France

75006

www.gseurat.com

Pointillism

918-3-15-152420-0

Solutions

Expert Solution

uses of c++
     C++ is used by programmers to create computer software.. C++ is mostly used to write device driver programs, system software, and applications that depend on direct hardware manipulation under real-time constraints.

input

include <iostream>
using namespace std;
#define MAX_LENGTH 100

void printInitials(const string& name)

{

    if (name.length() == 0)

        return;

  

    // Since touuper() returns int, we do typecasting

    cout << (char)toupper(name[0]);

  

    // Traverse rest of the string and print the

    // characters after spaces.

    for (int i = 1; i < name.length() - 1; i++)

        if (name[i] == ' ')

            cout << " " << (char)toupper(name[i + 1]);

}

  

// Driver code

int main()

{

    string name = "Impression, Sunrise";

    printInitials(name);

}


int main()
{
        char name[MAX_LENGTH]={0};
        cout<<"Enter first name of the person: ";
        cin.getline(name,MAX_LENGTH);
        cout<<"Enter last name of the person: ";

cin.getline(name,max_LENGTH);

};

class address {
        int hno;
        char cty[30];
        char state[30];
        public : 
                void getad()
                {
                        cout<<"house number : ";
                        cin>>hno;
                        cout<<"city :";
                        cin>>cty;
                        cout<<"state : ";
                        cin>>state;
                }
                void putad()
                {
                        cout<<"House No.: "<<hno<<",city: "<<cty<<",state: "<<state<<endl;
                }
};

  int main()

{

char website[MAX_LENGTH]={0};

cout<<"Enter website : ";

cin.getline(website,MAX_LENGTH);

cout<<"Enter category: ";

cin.getline(category,max_LENGTH);

clrscr();

int i, num;

cout<<"Enter a number: ";

cin>>num;

cout<<"\nTable of "<<num<<" is:\n\n";

for(i=1; i<=10; i++)

{

cout<<num<<setw(3)<<"*"<<setw(4)<<i<<setw(4)<<"="<<setw(4)<<num*i<<"\n";

}

getch();

output

Title of painting:Impression, Sunrise

Enter first name : Claude

Enter last name : Monet

Address street number : 361

Address street name : Giverny

Address city : France

Enter website :  www.claudemonet.com

Category : Impressionism

Number : 968-3-16-158420-0


Related Solutions

C++ Classes & Objects Create a class named Student that has three private member: string firstName...
C++ Classes & Objects Create a class named Student that has three private member: string firstName string lastName int studentID Write the required mutator and accessor methods/functions (get/set methods) to display or modify the objects. In the 'main' function do the following (1) Create a student object "student1". (2) Use set methods to assign StudentID: 6337130 firstName: Sandy lastName: Santos (3) Display the students detail using get functions in standard output using cout: Sandy Santos 6337130
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class definitions, one base class and three derived classes. The derived classes will have an inheritance relationship (the “is a” relationship) with the base class. You will use base and derived classes. The base class will have at least one constructor, functions as necessary, and at least one data field. At least one function will be made virtual. Class members will be declared public and...
I need to create a program that will simulate an ATM. The program has to be...
I need to create a program that will simulate an ATM. The program has to be written in JAVA that uses JOptionaPane to pop up the messages. It will need to simulate to get ** balance **withdraw **Deposit **exit the atm ** need to have a method that shows a receipt of everything that was done during the transaction
In Python, create a program with 2 classes that do the following. HashCreate class, this class...
In Python, create a program with 2 classes that do the following. HashCreate class, this class will accept a directory and hash each file in the directory and store the results in a dictionary. The dictionary will contain the hash value and file name. HashVerify, the second class will accept the dictionary as input and save that in an instance attribute. This class must also contain a method for lookups that require a file path as input. The lookup method...
Classes and Objects Write a program that will create two classes; Services and Supplies. Class Services...
Classes and Objects Write a program that will create two classes; Services and Supplies. Class Services should have two private attributes numberOfHours and ratePerHour of type float. Class Supplies should also have two private attributes numberOfItems and pricePerItem of type float. For each class, provide its getter and setter functions, and a constructor that will take the two of its private attributes. Create method calculateSales() for each class that will calculate the cost accrued. For example, the cost accrued for...
You need to create a Java class library to support a program to simulate a Point-...
You need to create a Java class library to support a program to simulate a Point- of-Sale (POS) system. General Requirements: You should create your programs with good programming style and form using proper blank spaces, indentation and braces to make your code easy to read and understand; You should create identifiers with sensible names; You should make comments to describe your code segments where they are necessary for readers to understand what your code intends to achieve. Logical structures...
In C++, there are 4 students that are running for class president. Create three arrays: the...
In C++, there are 4 students that are running for class president. Create three arrays: the candidate’s name, the number of votes the candidate receives, and the candidate’s percentage of the total votes. Your program should be broken down into at least 3 functions: find the total number of votes, calculate values for the percentage each candidate received, and sort the number of votes from highest to lowest. Write the candidate’s name, the total number of votes they received, and...
C++ Vectors. Create a program do the following in the program: 1. declare an vector without...
C++ Vectors. Create a program do the following in the program: 1. declare an vector without specifying the size 2. use push_back to add random integers between 100 and 999 to the vector 3. write a function that returns the smallest, largest, and average of the numbers in the vector display the smallest, largest, and average of the numbers in the vector
C++ Suppose the vector v = [4 -6 7]. Create three vectors: 1. p, which is...
C++ Suppose the vector v = [4 -6 7]. Create three vectors: 1. p, which is twice as long as v and points in the same direction as v 2. q, which has the same length as v and points in the opposite direction of v 3. r, which is three quarters the length of v and points in the same direction as v Print out the results of each vector calculation.
C++ program: Create a Date class that contains three members: the month, the day of the...
C++ program: Create a Date class that contains three members: the month, the day of the month, and the year, all of type int. The user should enter a date in the format 12/31/2001, store it in an object of type Date, then retrieve the object and print it out in the same format. Next create an employee class. The member data should comprise an employee number (type int) and the employee’s compensation (in dollars; type float). Extend the employee...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT