Results 1 to 2 of 2
i know this isn't the right place to discuss here but i need help desperatley.
hi, i'm currently in grade 11 taking the course computer science and i have just ...
- 11-26-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 0
Bluej help please
i know this isn't the right place to discuss here but i need help desperatley.
hi, i'm currently in grade 11 taking the course computer science and i have just finished this unit about java well mainly about the program called Blue J, and i unfortunatley failed one assignment, which is basicaly learning how to make a timezone class. can somebody please complete it for me, because honestly i have no idea wth i'm suppose to do, all i've managed to do was to make a 12 hour clock and 24 hour clock... on Blue J...barely. however not the timezone, here are the steps provided for the timezone class.
Problem Description
A national Wake-Up Call provider in Brampton broadcasts an automated time standard to its call centers across the country that reflects the local time at the user’s actual location in Canada. This ensures that call centre employees have a valid local time available to them.
Write a program that accepts the time in Brampton in 24 hour format and outputs the local time in each of the cities listed above including Brampton. You should assume that the input time will be valid (i.e., an integer between 0 and 2359 with the last two digits being between 00 and 59).
You should note that 2359 is one minute to midnight, midnight is 0, and 13 minutes after midnight
is 13. You do not need to print leading zeros, and input will not contain any extra leading zeros.
Sample Input
1300
Sample Output
1300 in Brampton
1000 in Victoria
1100 in Edmonton
1200 in Winnipeg
1300 in Toronto
1400 in Halifax
1430 in St. John’s
Fields
inputReader, type: Scanner
currentTime, type: integer
zoneTime, type: integer
Constructor
• Initialize currentTime to 0
• Store a new object of type Scanner in the inputReader field.
Methods:
NOTE: Write and test the setTime method first. Then write and test the setZoneTime method. Then write the nextPrevDay and convertForNfld methods and test them separately. Finally write and test the printTimeZones method.
Method 1 - printTimeZones
/** This method is the “main” method that runs the
/* other methods
*/
visibility:
public
return value:
none
parameters:
none
local variables:
none
point form description of actions to perform in the method:
• Call setTime
• Call setZoneTime(130)
• Call convertForNfld
• Print (“Newfoundland: “ + zoneTime)
• Print (“Saint John NB: “ + setZoneTime(100)
• Print (“Montreal: ” + setZoneTime(0))
• Print (“Winnipeg: “ + setZoneTime(-100))
• Etc.
Method 2 – setTime
/** This method gets the current time in Toronto from /* the user in military time (0000 – 2400 hours.
/* Remember that as with the clock program, the
/* rightmost two digits only go to 59
/* before the hours increment. In this case, however, /* we will not use a separate
/* class for hours and /* minutes. )
*/
visibility:
private
return value:
none
parameters:
none
local variables:
none
point form description of actions to perform in the method:
• Ask user for current time in Toronto
• Set currentTime to user specified time
Method 3 - setZoneTime
/** This method receives an offset from Toronto time as a parameter (E.g. -130 for NF, -/* 100 for NB, 100 for Winnipeg, 200 for Regina, etc.)
*/
visibility:
private
return value:
integer: zoneTime
parameters:
offsetFromToronto, type: int
local variables:
none
point form description of actions to perform in the method:
• zoneTime = currentTime + offsetFromToronto
• zoneTime = nextPrevDay(zoneTime)
Method 4 - nextPrevDay
/** This method calculates whether the offset puts them /* into the next or previous day and adjusts
/* accordingly
*/
visibility:
private
return value: integer zoneTime;
parameters: integers offset, current
local variables:
none
point form description of actions to perform in the method:
• You will need an if/else statement to modify the time if it is over 2400 or less than 0. If it is over 2400, simply subtract 2400 from the time. If it is less than 0, you will add 2400 to zoneTime.
Method 6 - convertForNfld
visibility:
private
return value:
int zoneTime
parameters:
none
local variables:
none
point form description of actions to perform in the method:
• Use modulus division to figure out whether the rightmost two digits of zoneTime are > 60. If they are, subtract 60 from the rightmost two digits and add an hour. Set timeZone to the proper time. So 1375 would become 1415.
- 11-26-2009 #2
Check out this link:
http://www.linuxforums.org/forum/lin...ums-rules.htmlMake mine Arch Linux



