Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > .NET Frameworks (точка нет фреймворки) > C# (си шарп)
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 05.12.2012, 22:12   #1
Dima_m
Новичок
Джуниор
 
Регистрация: 05.12.2012
Сообщений: 2
По умолчанию диаграммы взаимодействия

class Program
{
public class Time
{
public int hours;
public int minutes;
public int seconds;

public Time()
{hours = 11;
minutes = 22;
seconds = 22;
}
public Time(int hours, int minutes, int seconds)
{
this.hours = hours;
this.minutes = minutes;
this.seconds = seconds;

}
private void IncHours()
{
if (hours < 23)
{
hours++;
}
else if (hours >= 23)
{
hours = 0;
}

}
protected void IncMins()
{
}
private void IncSecs()
{
{

IncMins();
}

}
public void DecHours()
{ }

public void DecMins()
{ }
public void DecSecs()
{ }
}


public void Display()
{ }
public void InputTime()
{ }
B: Console.WriteLine("Please enter minutes");
/*t1.*/
minutes = int.Parse(Console.ReadLine());
if (/*t1.*/minutes > 59)
{
Console.WriteLine("Invalid Format, ");
goto B;
}
C: Console.WriteLine("Please enter seconds");
/*t1.*/
seconds = int.Parse(Console.ReadLine());
if (/*t1.*/seconds > 59)
{
Console.WriteLine("Invalid Format, ");
goto C;
}
}



public void IncOutput()
{
Console.WriteLine("Increasing :");
IncSecs();
Display();
Console.ReadKey();
IncMins();
Display();
Console.ReadKey();
IncHours();
Display();
Console.ReadKey();
}
public void DecOutput()
{
Console.WriteLine("Decreasing :");
DecSecs();
Display();
Console.ReadKey();
DecMins();
Display();
Console.ReadKey();
DecHours();
Display();
Console.ReadKey();
}

public void GoodOutput()
{ }

public static Time operator+( Time t1, int x)
{ }

Time t2 = new Time(t1.hours, t1.minutes, t1.seconds);


return t2;
}

public static Time operator +(Time t1, Time t2)
{
Time t3 = new Time(t1.hours + t2.hours, t1.minutes + t2.minutes, t1.seconds + t2.seconds);
if ((t1.seconds + t2.seconds) > 59)
{
int n = (t1.seconds + t2.seconds) / 60;
t3.seconds = (t1.seconds + t2.seconds) - 60 * n;
t3.minutes += n;
}
if ((t1.minutes + t2.minutes) > 59)
{
int n = (t1.minutes + t2.minutes) / 60;
t3.minutes -= 60 * n;
t3.hours += n;
}
if ((t1.hours + t2.hours) > 23)
{
int n = (t1.hours + t2.hours) / 24;
t3.hours -= 24*n+1;
}


return t3;

}


public static Time operator-(Time t1, int x)
{
int secs = t1.hours * 3600 + t1.minutes * 60 + t1.seconds;
secs-= x;
while (secs < 0)
{
secs += 24 * 3600;
}

}
public static Time operator -(Time t1, Time t2)
{


while (secs < 0)
{
secs += 24 * 3600;
}
t1.hours = (int)secs / 3600;
t1.minutes = (int)(secs - t1.hours * 3600) / 60;
t1.seconds = (int)(secs - t1.hours * 3600) % 60;
return new Time(t1.hours, t1.minutes, t1.seconds);
}

public static void Result(Time t1)
{
}
}
Dima_m вне форума Ответить с цитированием
Старый 05.12.2012, 22:14   #2
Dima_m
Новичок
Джуниор
 
Регистрация: 05.12.2012
Сообщений: 2
По умолчанию

помогите сделать диаграмму взаимодействия на основе этого кода)
Dima_m вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Теория взаимодействия программы и игры zinador Общие вопросы C/C++ 0 13.02.2012 20:19
Схема взаимодействия С++ Денис999 Помощь студентам 2 04.12.2011 20:07
memcached. Вопрос взаимодействия Виталий Желтяков PHP 3 13.11.2010 12:49
Проблема взаимодействия потока с формой Arkuz Общие вопросы Delphi 4 26.02.2010 22:35
взаимодействия file & image LeoN PHP 11 26.05.2008 05:28