Urgent- C++ classes

I have a problem about writing the cpp and main file given the header file as below to complete a C++ class definition

The header file "speed_calc.h" is used to answer the following questions.

#ifndef SPEED_CALC_H
#define SPEED_CALC_H
class speed_calc
{
private:
int precision;
public:
speed_calc(int p);
double printSpeed(double seconds, double meters);
void changePrecision(int p);
};
#endif

Q1. Write the code that belongs in speed_calc.cpp (Note: To calculate speed, u need to divide distance by time)

I don't know whether I should calculate the speed in the function printSpeed or otherwise? And what's the changePrecision(p) do?

Q2. Draw the UML diagram for speed calc (work backwards from speed calc.h)

Q3. Write the code belonging in a file called main.cpp, that will ask prompt the user for seconds, meters and precision and then print the calculated speed out.

Can anybody help to finish the speed_calc.cpp and main.cpp? thanks so much.
The questions you have look to be ones you should direct at your tutor, as they are to do with what you are expected rather than creating a solution.
My take on it would be to look at what you have, and what you cna figure out about it, which shoudl be enough to answer your questions.
My reasoning would follow the lines of;
1) sped_calc has a private int precision.
2) So changePrecision is likely to be sonething to do with this.
3) speed_calc constructro takes an int p as a parameter teh saem as changePrecision, so that could be the saem thing as well.
3) No private member for the speed, so need to calc as required.
4) Precision when refering to output of a decimal number refers to the number of digits after the decimal point, so pi to a precision of 4 is 3.1416.
Topic archived. No new replies allowed.