Class has three data member

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flash
    New Member
    • Nov 2006
    • 14

    Class has three data member

    I need help in C++
    .Class name Driller has three data member (int Code Private, int Quantity private and Name public)

    it has 3 function:
    1. Depth, the drills drills is based on the following:
    code 2000 depth(m) 300, code 3000 depth 500 and code 4000 depth 1000.

    2. Cost which computes the daily cost for using driller it uses the following:
    depth (300) daily cost (quantity*100)
    depth 500 daily cost (quantity + 1*100)
    depth 1000 daily cost (quantity + 3 *100)

    write constructor that initializes that data members using some values supplied by the main program.

    Main program is creats an array of 3 drillers, the information for these three driller is:
    Code 2000 Name katarpelar Quantity 3
    Code 3000 Name Sumsung Quantity 3
    Code 2000 Name GM Quantity 3

    for the three drillers, display the drilling depth and the daily cost.

    =============== =============== =============
    # include <iostream>
    # include <string.h>
    using namespace std;
    class Driller{
    int Code;
    string name;
    int Quantity;
    .
    .
    .
    .
    .
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    OK. So far so good. Post again when you are really stuck.

    Comment

    • flash
      New Member
      • Nov 2006
      • 14

      #3
      # include <iostream>
      # include <string>
      using namespace std;
      class Driller{
      int Code;
      string name;

      viod setValue( int Code, int Depth){
      if Code == 2000 then Depth ==300;
      else
      if Code == 3000 then Depth == 500;
      else
      if code == 4000 then Depth == 1000;
      }

      voidGetvalues int Code, int Depth){
      ???
      }

      Cost( ){



      }

      int main(){
      int Code;
      int Quantity;
      string "Name";
      .
      ?

      }

      Comment

      Working...