Beispiel #1
0
        /*   item c)    */
        public void Valor_Estacionamento()
        {
            Tempo estacionamento = new Tempo();

            estacionamento = saida.Subtrai_Tempo(entrada);
            if (estacionamento.getHora() < 1)
            {
                Console.WriteLine("O valor do estacionamento é R$7,00");
            }
            else
            {
                Console.WriteLine("O valor do estacionamento é R$" + (estacionamento.getHora() * 7) + ",00");
            }
        }
Beispiel #2
0
        /*   item f)    */

        public Tempo Subtrai_Tempo(Tempo tempo)
        {
            Tempo t = new Tempo();

            t.setHora(hora - tempo.getHora());
            t.setMin(min - tempo.getMin());
            t.setSeg(seg - tempo.getSeg());

            if (t.seg < 0)
            {
                t.seg = (60 + t.seg);
                t.min--;
            }
            if (t.min < 0)
            {
                t.min = (60 + t.min);
                t.hora--;
            }

            return(t);
        }
Beispiel #3
0
        /*   item e)    */

        public Tempo Adiciona_Tempo(Tempo tempo)
        {
            Tempo t = new Tempo();

            t.setHora(hora + tempo.getHora());
            t.setMin(min + tempo.getMin());
            t.setSeg(seg + tempo.getSeg());

            if (t.seg >= 60)
            {
                t.seg = (t.seg - 60);
                t.min++;
            }
            if (t.min >= 60)
            {
                t.min = (t.min - 60);
                t.hora++;
            }

            return(t);
        }