Please help

Pages: 12
I have two questions and i do not know how to solve them.
Can someone help me please?





1. Create a class named Circle. The members of the class are radius, area, and diameter. Include the following methods
1. set () which reads the value for radius from the user.
2. computediameter() to find the diameter of the circle( 2* radius)
3. computearea() to find the area of the Circle(3.14 * r* r)
4. printall () prints diameter, radius, area.
5. Create two objects for the class and print.




2. Write a class called Account which contains two private data elements, an integer accountNumber and a double accountBalance, and three member functions:
1. A constructor that allows the user to set initial values for accountNumber and accountBalance.
2. A function called inputTransaction, which reads a character value for transactionType ('D' for deposit and 'W' for withdrawal), and a double value for transactionAmount, which updates accountBalance.
3. A function called printBalance, which prints on the screen the accountNumber and accountBalance.
4. Test your functions in the main method.



Last edited on
Do you know how to create a class?
Like this?



class classname
{
private :
members;
list of functions;
public :
members;
list of functions;
protected:
members;
list of functions;
}
Make one called Circle.
I know only general small ideas but the exact details i do not know how.

Can you donate and solve it for me please?
1
2
3
class Circle{

};


Now you fill in the rest from the instructions;
The members of the class are radius, area, and diameter. Include the following methods...

Like this??

class Circle
{
float radius, area,diameter;
viod set()
void computediameter()
void computearea()
void printall()
};
Please use the markup for code.

You need to put
[/code]
after your code, and
[code]
before your code.

You can do this easily by highlighting all your code and clicking the <> in the box on the right.

Your class has void spelled wrong and is missing a lot of semi-colons.
Last edited on
Like this??

1
2
3
4
5
6
7
8
class Circle
{
float radius, area,diameter;
viod set()
void computediameter()
void computearea()
void printall()
};

Like this?

1
2
3
4
5
6
7
8
class Circle
{
float radius, area,diameter;
void set();
void computediameter();
void computearea();
void printall();
};
Thin what to do?
Thin what to do?


Write the functions.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Circle
{
float radius,area,diameter;
void set()
{
cout<<"Please enter the value of radius"<<endl
cin>>radius<<
};
void computediameter()
{
cout<<""diameter is: "<<diameter<<endl;
diameter=2*radius;
};
void computearea()
{
cout<<"Area is: "<<area<<endl;
area=3.14 * radius* radius;
};
void printall()
{
cout<<radius<<endl;
cout<<area<<endl;
cout<<diameter<<endl;
}; 
Correct?
You quite clearly know how to do this. Why did you turn up and say you did not know how to do this?
i know but i get errors when i compile it
And i need to call the methods from the main
i know but i get errors when i compile it


I will use my psychic powers to guess what the errors are, shall I?

http://www.cplusplus.com/articles/Ny86b7Xj/
Also i need to Create two objects for the class and print

How to do that?
If you do not know how to create an object, give up now. This is far too advanced for you. Most people have learned in the first five minutes how to do this. Here is what they learn first; creating an object of type int.

int x;
Pages: 12