Jump to content

[REQUEST] This is a project for my Examps in the Univercity. CHECK IT!


Recommended Posts

Posted

This is an excerpt from a book and maybe is the answer can you help ? :)

 

Task 1 - the Time class                               15 marks

The Time class provided already has two methods  getElapsedTime and getTotalMinutes. There will be no need to make changes to getElapsedTime, but you will need to amend getTotalMinutes.

 

1.1 Amend Time class so that it has two private fields of type int to represent the elements of time: hour and minute.

 

1.2 Provide a constructor which has no parameters and initialises the time to midnight (0hr 0 min).

 

1.3 Write a private mutator setHour which sets the value of the hour field from a suitable parameter. If the value of the parameter is within an appropriate range (between 0 - 23), the mutator should set the value of the hour field to the parameter value.  If the parameter value is outside the appropriate range, the mutator sets the field value to 0.

 

1.4 Write a private mutator  setMinute whose behaviour is similar to setHour but which uses the range appropriate for minutes (between 0 - 59). It sets the minutes field either to the value of the parameter if it is in range, or to 0 if it is outside the range.

 

1.5 Write a public mutator setTime, which sets the time from suitable formal parameters. The values of the parameters should be in the appropriate range: 0-59 for the minutes and 0-23 for the hour. If the value of a parameter is not in the required range, the value of the corresponding field should be set to 0 by the method. To avoid duplicating code, you should consider using appropriate local method calls.

 

1.6 Provide a second constructor which sets the time from suitable formal parameters. The values of the parameters must be in the appropriate range: 0-59 for the minutes and 0-23 for the hour. If the value of a parameter is not in the required range, the value of the corresponding field should be set to 0 by the constructor. To avoid duplicating code, you should consider using appropriate local method calls.

 

1.7 Write an accessor  getAsString  which returns a String representation of the time using two digits each for hour and minute separated by a colon (: ) e.g.  14:35, 07:34, 02:03 and 00:00 for midnight.

(Hint: look at the Date class).

 

1.8 Amend the code in accessor getTotalMinutes to convert a time into a total number of minutes and returns this as an int. For example, if the current time object stores 3:15, then getTotalMinutes returns the value 195. This is a private method to be called locally in getElapsedTime

 

Task 2 - the Vehicle class                               20 marks

2.1 The Vehicle class must store the following information: the reference number as an int, the vehicle’s plate as a String, the responsible technician’s (person’s) name as a String, the manufacture date of the vehicle as a Date. In addition, the class also stores the arrival time and the time they started the service session, both of type Time.

 

2.2 Write a constructor which sets the reference number, plate, technician’s name and manufacture date from suitable formal parameters. The date of manufacture should be represented by three formal parameters of type int which are then passed on as actual parameters to a Date constructor. The time when the vehicle arrived and the time when they start servicing should be set to null.

2.3 Write accessors :

• getVehicleNo which returns the vehicle’s reference number

• getRPName which returns the name of the technician as a String

• getManufactureDate which returns the vehicle manufacture date as a Date

 

2.4 Write mutators setArrivalTime and setServiceStart to set the time the vehicle arrived and the time the service session started from suitable formal parameters of type int. These formal parameters should be used to create fields of type Time with suitable values. (Remember, arrival time and service start are both of type Time, which already has constructors/methods to handle time)

 

2.5 Provide a method getAsString which returns a String representation of all the information stored about a vehicle. The String should contain the vehicle’s plate, reference no, technician’s name, date of manufacture and any other text which you think will improve the presentation. 

 

To avoid runtime errors, arrival time and the service start time should only be added to the return String, if the fields which store them are NOT null.

 

2.6 Provide an accessor getWaitingTime which returns an integer representing the number of minutes that have elapsed between the vehicle arriving and the start of the service session. Again, this should only happen if the fields which store them are not null. If either field is null, the method should return -1.

 

 

Task 3 - Testing the Time class                               14 marks

3.1 Write a tester class TimeTest, with a method doTest, to test that your Time class behaves according to the above specification. You will need to make sure that:

• Time objects are initialised from the constructor's formal parameters according to the specification given above

• Time objects can have their values set from the formal parameters of mutators, according to the specification given above

• getAsString  returns a suitable String representation of a time

• getElapsedTime returns the correct results

Choose your data carefully to ensure that you have checked the different situations which can occur.

Provide output statements so that, when doTest is invoked, output is printed in the Terminal window to show the results of your tests, and include comments in the method saying what is being tested.

 

Note: you can only use this class to test the public methods in Time. However, if these methods do not work properly, the problem may be with private methods which they call.

 

 

Task 4 - Write the DayLog class                               16 marks

4.1 The DayLog class stores information about vehicles serviced on a particular date. It has the following fields:

• logDate - should be of type Date. You should use the class provided.

• noOfArrivals - stores the number of vehicles that arrived at the service point on that day 

    and is initialised to 0.

• waitingList - an Vector used to hold the collection of Vehicles waiting for

service.

• serviceList  - an Vector used to hold the collection of Vehicles who have

started the service session.

4.2 Provide a constructor which initialises the date from suitable formal parameters and the number of arrivals to zero. It should also create the two collection fields.

 

4.3 Provide the mutator addVehicle, which has a formal parameter of type Vehicle and two ints to

represent the hour and minute when the vehicle arrived. The method sets the vehicle’s arrival time from formal parameters, increments the number of arrivals and adds the vehicle to the end of the collection of vehicles waiting to be serviced.

 

4.4 Provide the following accessors:

• getArrived - returns the number of vehicles that arrived at the service point that day

• getNumberWaiting - returns the number of vehicles in the waiting list

• findWaitingPosition - has a formal parameter of type Vehicle and returns either the 

        position of  the vehicle on the waiting list or  -1

        if the vehicle is not on the waiting list.

 

 

4.5 Provide the method serviceVehicle. The parameters of this method will be a Vehicle and two ints which represent the hour and minute when the vehicle started the service session. The method should set the vehicle’s service start time, find the position of the vehicle in the collection of vehicles on the waiting list, and use this position to remove that vehicle from the waiting list, then add the vehicle to the collection of those being serviced. Only vehicles that are in the waiting list should be served. If a vehicle is not in the waiting list, it cannot be transferred from the waiting list to the service list.

 

Task 5 - Testing the DayLog class                               10 marks

Write a tester class DayLogTest with a doTest method. Your code should create a Daylog object and some Vehicle objects, then call methods on the DayLog object in a way which shows that these methods work according to specification. At this stage, you have not been asked to provide methods which display the details of vehicles on the waiting and the service lists, but you should ensure that the numbers of vehicles on those lists are consistent with the results expected from your method calls.

 

Provide output statements so that, when doTest is invoked, output is printed in the Terminal window to show the results of your test. Include comments in the method saying what is being tested.

 

Task 6 - Extensions to DayLog class                               10 marks

This task will provide a challenge for students who are confident in their abilities. It is possible to get a very good mark for the coursework without attempting this task.

 

6.1 Provide a method printReport which prints to the terminal window the date, the number of vehicles that have arrived at the service point on that day, the number of vehicles still waiting to start their service session, and the number of vehicles that have started the service session.

 

6.2 Add the following methods to the DayLog class:

• printWaitingList prints to the terminal window the date, and a list of vehicles that are

awaiting for service

• printServiceList prints to the terminal window the date,  and a list of vehicles

    for which the service session has been initiated

• getAverageWaitingTime returns a double representing the average(mean) waiting time

(in minutes)  for vehicles for which service has started. You will need to iterate through the 

          serviceList to get the waiting times for each vehicle.

 

Include the average waiting time in the report described in 6.1.

6.3 Ensure that these new methods are tested in DayLogTest.

 

Task 7 - Demonstration                               10 marks

 

In a scheduled practical, you will be asked to demonstrate that you have a good working knowledge of the code that you have submitted. The main purpose of the demonstration is to authenticate your code by showing that you know it well enough to make changes.

 

 

 

 

 

 

Posted

tl;dr

I delete the story and keep only the Quetions :3

If you know the book or someway to find the solution in the google post it,

Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • You think you have good “l2j” files until you try running a low-rate server.   Saying “there’s not a single L2 server out there worth mentioning” just shows you probably only know the first 10 servers on voting sites, the same voting sites that owned by them. You call the forum dead, yet you’re here discussing your next projects… From my perspective, you don’t seem ready to run any L2 server in 2025. Around 70% of players are here for RMT or ask for payment just to bring their clan, and you really think the community cares about Premium or donations or files quality? The other 20% spend their time downloading and deleting servers all day, playing for one day, then quitting for whatever random reason. And finally, the last 10% are the only ones who actually play because they genuinely like your features, your server files, and your overall project. Good luck 🙂
    • I genuinely admire your bravery - in an age where AI can whip up something better in under a minute, you still stubbornly try to sell these "projects" of yours on a forum that’s been clinically dead for years. That’s no longer determination, that’s digital archaeology. I just can’t tell whether you’re actually trying to make money, or simply testing how much we can endure before we ask an AI to generate you some actual talent.   And ofc AI will make it for free, $220 saved.
    • I’m glad I’m not the only one who appreciates Maxthor’s involvement in group gay orgies, he can’t be bothered to reply to messages, but covering the entire forum in gay lights is absolutely no issue for him. As for the project - the forum is packed with feedback from the testers, the lads are spending every spare moment fixing even the tiniest typo in an NPC’s text. I’ll share the links as soon as I get the green light. Edit: I forgot to add that the GM recruitment will begin once the links are released. Three people will be accepted, and they’ll work in a three-shift rotation so that there’s always a GM available online.
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
    • One of best project i play last few years
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock