Question

OBJECT ORIENTED PROGRAMMING C++

B- The programming section has 2 parts: Part 1 - Create a class - (35 points) Create a class called CustomDressInvoice. It sh

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

Code:

#include<iostream>
using namespace std;
class CustomDressInvoice{
   public:
       int designTime;
       int designRate;
       int sewingTime;
       int sewingRate;
       int materialsCost;
       CustomDressInvoice(){
           designTime=0;
       }
       CustomDressInvoice(int designTim){
           designTime=designTim;
       }
       void setDesignTime(int designTim){
           designTime=designTim;
       }
       void setDesignRate(int designRat){
       designRate=designRat;
       }
       void setSewingTime(int sewingTim){
           sewingTime=sewingTim;
       }
       void setSewingRate(int sewingRat){
           sewingRate=sewingRat;
       }
       void setMaterialsCost(int materialsCost){
            materialsCost=materialsCost;
       }
       int getDesignTime(){
           return designTime;
       }
       int getdesignRate(){
           return designRate;
       }
       int getsewingTime(){
           return sewingTime;
       }
       int getsewingRate(){
           return sewingRate;
       }
       int getmaterialsCost(){
           return materialsCost;
       }
       int getInvoiceAmount(){
           int invoice;
           invoice=designTime*designRate;
           invoice=invoice+(sewingTime*sewingRate);
           invoice=invoice+materialsCost;
           return invoice;
       }
};
int main(){
   CustomDressInvoice a; //first object
   int dt,dr,st,sr,mc;
   cout<<"Enter design time 1: ";
   cin>>dt;
   a.setDesignTime(dt);
   cout<<"Enter design rate 1: ";
   cin>>dr;
   a.setDesignRate(dr);
   cout<<"Enter sewing time 1: ";
   cin>>st;
   a.setSewingTime(st);
   cout<<"Enter sewing Rate 1: ";
   cin>>sr;
   a.setSewingRate(sr);
   cout<<"Enter materials cost 1: ";
   cin>>mc;
   a.setMaterialsCost(mc);
   cout<<endl<<"Invoice amount is "<<a.getInvoiceAmount()<<endl<<endl;
   cout<<"Enter design time 2: ";
   cin>>dt;
   CustomDressInvoice b(dt);   //second object
   cout<<"Enter design rate 2: ";
   cin>>dr;
   b.setDesignRate(dr);
   cout<<"Enter sewing time 2: ";
   cin>>st;
   b.setSewingTime(st);
   cout<<"Enter sewing Rate 2: ";
   cin>>sr;
   b.setSewingRate(sr);
   cout<<"Enter materials cost 2: ";
   cin>>mc;
   b.setMaterialsCost(mc);
   cout<<endl<<"Invoice amount is "<<b.getInvoiceAmount()<<endl<<endl;  
}

Output:

Enter design time 1: 2 Enter design rate 1: 3 Enter sewing time 1: 4 Enter sewing Rate 1: 5 Enter materials cost 1: 6 Invoice

Add a comment
Know the answer?
Add Answer to:
OBJECT ORIENTED PROGRAMMING C++ B- The programming section has 2 parts: Part 1 - Create a...
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
  • Java - Object Oriented Programming From the game slither.io Identify objects that you can see ...

    Java - Object Oriented Programming From the game slither.io Identify objects that you can see on the picture. Pick one object from part a. Create a class (Java code) for that object which contain data member, method and constructor. Implement the class inside main function by creating that object.

  • can you solve it in java please Create the following: 1. Class Invoice ( the node...

    can you solve it in java please Create the following: 1. Class Invoice ( the node ) that includes three instance variables:     int No; // the Invoice No             String CustName; // the Customer name             int Amount; // the Invoice Amount Invoice next; // points to the next Invoice Default and overloaded constructors 2. Class Shop that includes three instance variables: Invoice head; Invoice Tail; Your class should have the following: • A method that initializes the instance variables....

  • Use C++ to implement a program uses objected oriented programming to calculate the area of a...

    Use C++ to implement a program uses objected oriented programming to calculate the area of a rectangle. The program should create a Rectangle class that has the following attributes and member functions: Attributes: width and length Member functions: setWidth(), setLength(), getWidth() , getLength(), getArea() Where width and length are the respect width and length of a Rectangle class. The setWidth() and setLength() member function should set the length and width, the getWidth(), getLenght(), and getArea() member function should get the...

  • Use DevC++ to implement a program uses objected oriented programming to calculate the area of a...

    Use DevC++ to implement a program uses objected oriented programming to calculate the area of a rectangle. The program should create a Rectangle class that has the following attributes and member functions: Attributes: width and length Member functions: setWidth(), setLength(), getWidth() , getLength(), getArea() Where width and length are the respect width and length of a Rectangle class. The setWidth() and setLength() member function should set the length and width, the getWidth(), getLenght(), and getArea() member function should get the...

  • It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming...

    It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming Challenge 2 Employee Class.pdf Program Template: // Chapter 13, Programming Challenge 2: Employee Class #include <iostream> #include <string> using namespace std; // Employee Class Declaration class Employee { private: string name; // Employee's name int idNumber; // ID number string department; // Department name string position; // Employee's position public: // TODO: Constructors // TODO: Accessors // TODO: Mutators }; // Constructor #1 Employee::Employee(string...

  • Write a program to create a set operation calculator applying object oriented programming principles discussed in...

    Write a program to create a set operation calculator applying object oriented programming principles discussed in the class so far. The set operation calculator need to be enclosed inside one class with different methods responsible for performing the different operations listed below. When the constructor (def __init__() ) is called during object instantiation, two separate objects of this class need to be instantiated two sets S1 and S2. These two set objects can be instantiated from two python lists taken...

  • Language is C++ Basic principles and theory of structured programming in C++ by implementing the class:...

    Language is C++ Basic principles and theory of structured programming in C++ by implementing the class: Matrix Use these principles and theory to help build and manipulate instances of the class (objects), call member functions Matrix class implementation from the main function file and, in addition, the Matrix class must have its interface(Matrix.h) in a separate file from its implementation (Matrix.cpp). The code in the following files: matrix.h matrix.cpp matrixDriver.h Please use these file names exactly. Summary Create three files...

  • 1) Using the O-O Paradigm create a class in C++ for the object Dog 2) Implement...

    1) Using the O-O Paradigm create a class in C++ for the object Dog 2) Implement ALL the behaviors  (member functions/methods- including any needed constructors, and helper methods ) of the class. 3) Write the necessary Client/Application/User program The Client program should do the following: a) create at least 4 objects. b) show all the behaviors

  • Please help with this assignment. Thanks. 1. Write a C++ program containing a class Invoice and...

    Please help with this assignment. Thanks. 1. Write a C++ program containing a class Invoice and a driver program called invoiceDriver.cpp. The class Invoice is used in a hardware store to represent an invoice for an item sold at the store. An invoice class should include the following: A part number of type string A part description of type string A quantity of the item being purchased of type int A price per item of type int A class constructor...

  • C# P-9 Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming...

    C# P-9 Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming methodologies. Design a class named Contractor. The class should keep the following information: • Contractor name • Contractor number • Contractor start date Write one or more constructors, and the appropriate accessor and mutator functions for the class. For this assignment and P-10 you will have to include an algorithm for you program. This will be a word document attached to the dropbox. Submit...

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