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 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: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: 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 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