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;
.
.
.
.
.

--------------------------------------------------------------------------------

Recommended Answers

All 2 Replies

what do you need help doing ?

>># include <string.h>
That is the wrong header file which contains C functions for manipulating character arrays. What you want is #include <string>; , without the .h file extension

Do you know how to write a constructor ? You will find them explained in your text book. Have a go at it them repost what you did if you still have question about it.

# include <iostream>
# include <string.h>
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";
?

}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.