Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9913

Re: mod calculation

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sun, 13 Nov 2011 11:03:00 -0600
Date Sun, 13 Nov 2011 09:02:59 -0800
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows NT 5.2; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: mod calculation
References <c884824e-9b4a-4df5-8d4a-3dddd6e41bea@d37g2000prg.googlegroups.com>
In-Reply-To <c884824e-9b4a-4df5-8d4a-3dddd6e41bea@d37g2000prg.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <h7SdnWHCRqnZZSLTnZ2dnUVZ_qqdnZ2d@earthlink.com> (permalink)
Lines 54
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 75.8.127.7
X-Trace sv3-YKGPuLZjFLmFE510Ee+qnQhE3t240gJVOIKPsRQB6uw9kk/J+l8FCe30aj5t4263gW4m11+5tB16w34!Uq7BTK0OPAyxiOGT0L5ck9fRmx5j5hQ2G+nu2Ydh2i48pkFq5iv+m296OYqqP0o7JlXwjb8xXBqA!PqVdpOoo729kH4LxXhKnqAeu6cOORFcOC0dBJvaptg==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2574
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9913

Show key headers only | View raw


On 11/13/2011 8:20 AM, Chad wrote:
> I'm working on a school project. Part of the requirement is to read in
> the following data file
>
> 37259 9819
> 46363 22666
> 46161 79934
> 5693 31416
> 91459 8272
> 72792 9493
> 83603 8372
> 77842 64629
> 84792 747
> 1299 178
>
> And then calculate anyNewArrival and serviceTime based on the
> following formulas...
>
> //read data1 and data2 from the file
> anyNewArrival = (((data1%100)+1)<=50);
> serviceTime = (data2%5)+1);
>
> where data1 and data2 are read from the file
>
> I get the following by calculating anyNewArrival
>
> 37259 ---->  60 false
> 46363 ----->  64 false
> 46161 ----->  62 false
> 5693 ------>94 false
> 91459 ---->  60 false
> 72792 ----->93 false
> 83603 ----->04 true
> 77842 ----->43 true
> 84792 ----->93 false
> 1299 178 ---->  1000 false
>
> That means the only two arrivals should be
>
> 83603 ----->04 true
> 77842 ----->43 true
>
>
> However, according to the output he gave us in the class, the number
> of arrivals are 4. Ideas?

This is the sort of thing you really need to discuss with your
instructor or TA. You may be misunderstanding something in the
assignment, or have the wrong data file, or ...

There is something wrong with the last line of your output.
((data1%100)+1) is not 1000, regardless of the value of data1.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

mod calculation Chad <cdalten@gmail.com> - 2011-11-13 08:20 -0800
  Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-13 08:56 -0800
    Re: mod calculation Chad <cdalten@gmail.com> - 2011-11-13 09:26 -0800
      Re: mod calculation Steve Sobol <sjsobol@JustThe.net> - 2011-11-13 13:08 -0800
        Re: mod calculation Chad <cdalten@gmail.com> - 2011-11-13 13:12 -0800
          Re: mod calculation Patricia Shanahan <pats@acm.org> - 2011-11-13 13:49 -0800
  Re: mod calculation Patricia Shanahan <pats@acm.org> - 2011-11-13 09:02 -0800
    Re: mod calculation Chad <cdalten@gmail.com> - 2011-11-13 09:09 -0800
      Re: mod calculation Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-13 20:20 +0000
      Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-14 09:55 -0800
        Re: mod calculation Patricia Shanahan <pats@acm.org> - 2011-11-15 13:05 -0800
          Re: mod calculation Gene Wirchenko <genew@ocis.net> - 2011-11-15 14:17 -0800
            Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-17 07:23 -0800
              Re: mod calculation Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-11-17 07:51 -0800
              Re: mod calculation Lew <lewbloch@gmail.com> - 2011-11-17 09:35 -0800
              Re: mod calculation Gene Wirchenko <genew@ocis.net> - 2011-11-17 10:10 -0800
                Re: mod calculation Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-17 19:09 +0000
                Re: mod calculation Patricia Shanahan <pats@acm.org> - 2011-11-17 14:17 -0800
                Re: mod calculation Arne Vajhøj <arne@vajhoej.dk> - 2011-11-19 21:11 -0500
                Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-18 20:35 -0800
                Re: mod calculation Arne Vajhøj <arne@vajhoej.dk> - 2011-11-19 21:13 -0500
                Re: mod calculation Gene Wirchenko <genew@ocis.net> - 2011-11-19 23:47 -0800
                Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-18 20:54 -0800
                Re: mod calculation Lew <lewbloch@gmail.com> - 2011-11-19 08:34 -0800
                Re: mod calculation Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-19 21:16 +0000
                Re: mod calculation Lew <lewbloch@gmail.com> - 2011-11-19 16:11 -0800
                Re: mod calculation Arne Vajhøj <arne@vajhoej.dk> - 2011-11-19 21:13 -0500
                Re: mod calculation Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-20 08:45 +0000
                Re: mod calculation Lew <lewbloch@gmail.com> - 2011-11-20 08:12 -0800
                Re: mod calculation Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-20 19:42 +0000
                Re: mod calculation spk <jhic@speak.invalid> - 2011-11-20 23:18 -0400
                Re: mod calculation thoolen <th00len@th0lenbot.thorium> - 2011-11-21 02:11 -0500
                Re: mod calculation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-19 13:40 -0800

csiph-web