Question

In: Computer Science

Using C++ Create the UML, the header, the cpp, and the test file for an ArtWork...

Using C++

Create the UML, the header, the cpp, and the test file for an ArtWork class.

The features of an ArtWork are:

Artist name (e.g. Vincent vanGogh or Stan Getz)
Medium (e.g. oil painting or music composition)
Name of piece (e.g. Starry Night or Late night blues)
Year (e.g. 1837 or 1958)

Solutions

Expert Solution

UML

ArtWork.h

#ifndef ARTWORK_H
#define ARTWORK_H

class ArtWork
{
    public:
        ArtWork(char *name, char *med, char *piece, int yr);   //Parameterized Constructor
        
        //Data Members or Attributes
        char *artistName;
        char *medium;
        char *nameOfPiece;
        int year;

        void showArtWork();
};

#endif // ARTWORK_H

ArtWork.cpp

#include "ArtWork.h"
#include<iostream>
using namespace std;

ArtWork::ArtWork(char *name, char *med, char *piece, int yr)   //Parameterized Constructor
{
    artistName=name;
    medium=med;
    nameOfPiece=piece;
    year=yr;
}

void ArtWork::showArtWork()    //Function to display all the values of data members or attributes
{
    cout<<"Artist Name : "<<artistName<<endl;
    cout<<"Medium : "<<medium<<endl;
    cout<<"Name of Piece : "<<nameOfPiece<<endl;
    cout<<"Year : "<<year<<endl;
}

Tester : main.cpp

#include <iostream>
#include <string.h>
#include <stdlib.h>
#include "ArtWork.h"

using namespace std;

int main()
{
    char name[30],med[30],piece[30];
    int yr;
    //Gathering required data from the User by taking input
    cout<<"Enter Artist Name : ";
    cin.getline(name,30);
    cout<<"Enter Medium : ";
    cin.getline(med,30);
    cout<<"Enter Name of Piece : ";
    cin.getline(piece,30);
    cout<<"Enter Year : ";
    cin>>yr;

    ArtWork aw1(name,med,piece,yr);   //Declaring object using Parameterized Constructor
    cout<<"\nShowing Art Work : \n";
    aw1.showArtWork();

    return 0;
}

OUTPUT


Related Solutions

Using C++ In a separate header file: Create a new type called "Patient" - you must...
Using C++ In a separate header file: Create a new type called "Patient" - you must use a  class. Give your "Patient" type at least five (5) member elements of your choosing, and at least one member function. You should have member elements to hold patient name, and visitReason (which can change), and other items of your choosing. In your cpp file: Create at least one instance of Patient type (example: CurrentPatient ). Create a menu-driven program OF YOUR OWN DESIGN...
c++ ///////////////////////////////////////////////////////////////////////// need to be named Subsequences.h and pass test cpp file SubsequenceTester.cpp at the end...
c++ ///////////////////////////////////////////////////////////////////////// need to be named Subsequences.h and pass test cpp file SubsequenceTester.cpp at the end of this question. This assignment will help you solve a problem using recursion Description A subsequence is when all the letters of a word appear in the relative order of another word. Pin is a subsequence of Programming ace is a subsequence of abcde bad is NOT a subsequence abcde as the letters are not in order This assignment you will create a Subsequence...
This class should include .cpp file, .h file and driver.cpp (using the language c++)! Overview of...
This class should include .cpp file, .h file and driver.cpp (using the language c++)! Overview of complex Class The complex class presents the complex number X+Yi, where X and Y are real numbers and i^2 is -1. Typically, X is called a real part and Y is an imaginary part of the complex number. For instance, complex(4.0, 3.0) means 4.0+3.0i. The complex class you will design should have the following features. Constructor Only one constructor with default value for Real...
WRITE ONLY THE TO DO'S   in FINAL program IN C++ (necessary cpp and header files are...
WRITE ONLY THE TO DO'S   in FINAL program IN C++ (necessary cpp and header files are witten below) "KINGSOM.h " program below: #ifndef WESTEROS_kINGDOM_H_INCLUDED #define WESTEROS_KINGDOM_H_INCLUDED #include <iostream> namespace westeros { class Kingdom{         public:                 char m_name[32];                 int m_population; };         void display(Kingdom&);                      } #endif } Kingdom.cpp Program below: #include <iostream> #include "kingdom.h" using namespace std; namespace westeros {         void display(Kingdom& pKingdom) {                 cout << pKingdom.m_name << ", population " << pKingdom.m_population << endl;                                                               FINAL:...
answer in c++ First – take your Box02.cpp file and rename the file Box03.cpp Did you...
answer in c++ First – take your Box02.cpp file and rename the file Box03.cpp Did you ever wonder how an object gets instantiated (created)? What really happens when you coded Box b1; or Date d1; or Coord c1; I know you have lost sleep over this. So here is the answer………. When an object is created, a constructor is run that creates the data items, gets a copy of the methods, and may or may not initialize the data items....
Write a C++ program based on the cpp file below ++++++++++++++++++++++++++++++++++++ #include using namespace std; //...
Write a C++ program based on the cpp file below ++++++++++++++++++++++++++++++++++++ #include using namespace std; // PLEASE PUT YOUR FUNCTIONS BELOW THIS LINE // END OF FUNCTIONS void printArray(int array[], int count) {    cout << endl << "--------------------" << endl;    for(int i=1; i<=count; i++)    {        if(i % 3 == 0)        cout << " " << array[i-1] << endl;        else        cout << " " << array[i-1];    }    cout...
using the header: #include <pthread.h> // This is a header file for a Read/Right Lock Library....
using the header: #include <pthread.h> // This is a header file for a Read/Right Lock Library. Your C code //SHOULD access your routines using these exact function // prototypes typedef struct RW_lock_s { } RW_lock_t; void RW_lock_init(RW_lock_t *lock); /* This routine should be called on a pointer to a struct variable of RW_lock_t to initialize it and ready it for use. */ void RW_read_lock(RW_lock_t *lock); /* This routine should be called at the beginning of a READER critical section */...
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++...
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++ Rules: -Use fork(), exec(), wait(), and exit() _______________________________________________________________________________________________________________________________________________ -A line of input represents a token group. -Each token group will result in the shell forking a new process and then executing the process. e.g. cat –n myfile.txt // a token group -Every token group must begin with a word that is called the command(see example above). The words immediately following a command are calledarguments(e.g....
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++...
Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++ Rules: -Use fork(), exec(), wait(), and exit() _______________________________________________________________________________________________________________________________________________ -A line of input represents a token group. -Each token group will result in the shell forking a new process and then executing the process. e.g. cat –n myfile.txt // a token group -Every token group must begin with a word that is called the command(see example above). The words immediately following a command are calledarguments(e.g....
C++ Programming Simply explain what the difference between "including" a header file and using a compiled...
C++ Programming Simply explain what the difference between "including" a header file and using a compiled library file during linking? Where are the C++ header files and compiled C++ library files on your computer?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT