Program Help

I'm still fairly new to program and was recently given a program i have no clue how to do. Please help me if you can.

Put all the code in a .doc file and include a UML diagram for the Airplane class. You can use Microsoft Visio or another drawing tool. The code must conform to the Google C++ style sheet for order and indentation etc. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Class_Format

1. /*Write a class for an airplane class with constructors, interface (mutators and accessors) and a test driver (main)which should test everything.It should be able to change altitude (up,down) and speed. The constructor will set the altitude to 0 and speed to zero and longitude and latitude to Boston, Massachusetts. The overloaded constructor will set longitude and latitude to some numbers. If the altutude ever falls below 0 the change altutude function should should announce the plane had crashed and the program exit. Will be checked in class, submit code here */

2. /* Rewrite DayOfYear (see attached document) to use constructor to set day and month as well as a default constructor ( set to 0,0). The day and month member variables are now private and the set and display functions and constructors are public. Add a private check_date member function that gets called in the public set function and overloaded consturctor. */
//DISPLAY 10.3 Class with a Member Function//Program to demonstrate a very simple example of a class.
//A better version of the class DayOfYear will be given in Display 10.4.
#include <iostream>using namespace std;
class DayOfYear
{public: void output( );
int month;
int day;};
int main( )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{    DayOfYear today, birthday;
    cout << "Enter today's date:\n";   
cout << "Enter month as a number: ";   
cin >> today.month;   
cout << "Enter the day of the month: ";   
cin >> today.day;   
cout << "Enter your birthday:\n";   
cout << "Enter month as a number: ";   
cin >> birthday.month;   
cout << "Enter the day of the month: ";   
cin >> birthday.day;
cout << "Today's date is ";   
today.output( );   
cout << "Your birthday is ";   
birthday.output( );
if (today.month == birthday.month  && today.day == birthday.day)       
cout << "Happy Birthday!\n";   
else       
cout << "Happy Unbirthday!\n";
    return 0;}
//Uses iostream:
void DayOfYear::output( )
{    cout << "month = " << month         << ", day = " << day << endl;}
Last edited on
Topic archived. No new replies allowed.