1. (10 points each) Write declarations for each of the following:
2. (10 points each) Given a string s and an integer x
3. (10 points each) Given the following definition of the function ceil():
4. (10 points) Write a function that takes as parameters the lengths of the sides of a rectangle and returns the area.
double area_of_rect(double length, double width)
{
double area;
area = length * width;
return(area)
}
or
double area_of_rect(double length, double width)
{
return(length * width);
}
5. (10 points) Define a class called Radio that has:
Now show how you would declare a Radio object, and set its volume to 5.
class Radio {
private:
int volume;
double frequency;
public:
void set_volume(int);
double scan_up(void);
};
-----
Radio panasonic;
panasonic.set_volume(5);